Skip to content

Commit ccc663b

Browse files
committed
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 <[email protected]>
1 parent d226b14 commit ccc663b

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

builtin/add.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,22 @@ static int fix_unmerged_status(struct diff_filepair *p,
5252
return DIFF_STATUS_MODIFIED;
5353
}
5454

55+
static const char *add_would_remove_warning = N_(
56+
"You ran 'git add' with neither '-A (--all)' or '--no-all', whose\n"
57+
"behaviour will change in Git 2.0 with respect to paths you removed from\n"
58+
"your working tree. Paths like '%s' that are\n"
59+
"removed are ignored with this version of Git.\n"
60+
"\n"
61+
"* 'git add --no-all <pathspec>', which is the current default, ignores\n"
62+
" paths you removed from your working tree.\n"
63+
"\n"
64+
"* 'git add --all <pathspec>' will let you also record the removals.\n"
65+
"\n"
66+
"Run 'git status' to check the paths you removed from your working tree.\n");
67+
5568
static void warn_add_would_remove(const char *path)
5669
{
57-
warning(_("In Git 2.0, 'git add <pathspec>...' will also update the\n"
58-
"index for paths removed from the working tree that match\n"
59-
"the given pathspec. If you want to 'add' only changed\n"
60-
"or newly created paths, say 'git add --no-all <pathspec>...'"
61-
" instead.\n\n"
62-
"'%s' would be removed from the index without --no-all."),
63-
path);
70+
warning(_(add_would_remove_warning), path);
6471
}
6572

6673
static void update_callback(struct diff_queue_struct *q,

0 commit comments

Comments
 (0)