Re: jc/add-2.0-delete-default (Re: What's cooking in git.git (Apr 2013, #05; Mon, 15))

2013-04-21 Thread Junio C Hamano
Jonathan Nieder jrnie...@gmail.com writes:

 How about something like this?

   warning: git add run on path with files removed (e.g., '%s')
   hint: use git add --ignore-removals pathspec to ignore removals
   hint: or git add --no-ignore-removals pathspec to notice them
   hint: --ignore-removals is the default but this will change soon
   hint: see git-add(1) for details

 Then the --ignore-removals option could be added using a patch like
 the following.

adding ignore-removals as a synonym (and keeping it) would be a good
idea.

We would still need to carry --all and --no-all that have been with
us ever since we added -A option, though.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: jc/add-2.0-delete-default (Re: What's cooking in git.git (Apr 2013, #05; Mon, 15))

2013-04-21 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com writes:

 Then the --ignore-removals option could be added using a patch like
 the following.

 adding ignore-removals as a synonym (and keeping it) would be a good
 idea.

 We would still need to carry --all and --no-all that have been with
 us ever since we added -A option, though.

The final step to turn -A the default will be held back until Git 2.0 release,
but I've inserted the following patch before that step.

I am thinking that it would be a good idea to merge up to this step
to 'master' tomorrow, and have you guys tweak it further on 'master'
with a patch like the one I am responding to, before the 1.8.3
final.  We will have to tweak the 2.0 endgame version as we go but
that is outside 'next' for now, so it should be manageable.

-- 8 --
Subject: [PATCH] git add: rephrase the removal will cease to be ignored 
warning

Now the logic to decide when to warn has been tightened, we know the
user is in a situation where the current and future behaviours will
be different.  Spell out what happens with these two versions and
how to explicitly ask for the behaviour, and suggest git status as
a way to inspect the current status.

Signed-off-by: Junio C Hamano gits...@pobox.com
---
 builtin/add.c | 21 ++---
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/builtin/add.c b/builtin/add.c
index 4242bce..20f459a 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -52,15 +52,22 @@ static int fix_unmerged_status(struct diff_filepair *p,
return DIFF_STATUS_MODIFIED;
 }
 
+static const char *add_would_remove_warning = N_(
+   You ran 'git add' with neither '-A (--all)' or '--no-all', whose\n
+behaviour will change in Git 2.0 with respect to paths you removed from\n
+your working tree. Paths like '%s' that are\n
+removed are ignored with this version of Git.\n
+\n
+* 'git add --no-all pathspec', which is the current default, ignores\n
+  paths you removed from your working tree.\n
+\n
+* 'git add --all pathspec' will let you also record the removals.\n
+\n
+Run 'git status' to check the paths you removed from your working tree.\n);
+
 static void warn_add_would_remove(const char *path)
 {
-   warning(_(In Git 2.0, 'git add pathspec...' will also update the\n
- index for paths removed from the working tree that match\n
- the given pathspec. If you want to 'add' only changed\n
- or newly created paths, say 'git add --no-all pathspec...'
-  instead.\n\n
- '%s' would be removed from the index without --no-all.),
-   path);
+   warning(_(add_would_remove_warning), path);
 }
 
 static void update_callback(struct diff_queue_struct *q,
-- 
1.8.2.1-650-g3c8b519

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html