On Thu, Apr 18, 2013 at 10:51:12AM -0700, Junio C Hamano wrote:
> Jeff King <[email protected]> writes:
>
> > +static const char *add_would_remove_warning = N_(
> > +/* indent for "warning: " */
> > + "In Git 2.0, 'git add <pathspec>...' will also update the\n"
> > +"index for paths removed from the working tree that match the given\n"
> > +"pathspec. If you want to 'add' only changed or newly created paths,\n"
> > +"say 'git add --no-all <pathspec>...' instead.\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);
> > + static int warned_once;
> > + if (!warned_once++)
> > + warning(_(add_would_remove_warning));
> > + warning("did not stage removal of '%s'", path);
> > }
>
> Would "add --dry-run" say this, too?
It probably makes sense to continue to have the warning in the dry-run
case, but it may make sense to tweak it grammatically when we are in
dry-run mode. Saying "would stage removal" is technically correct, but I
think it is somewhat ambiguous: would git do it if we were not in a
--dry-run, or would git do it if it were Git 2.0?
Doing it as:
warning: not staging removal of '%s'
could work for both cases. Something like "not considering" (or another
synonym for "considering") might be even more accurate. It is not just
that we did not stage it; it is what we did not even consider it an item
for staging under the current rules.
Note that the "not staging" warnings may potentially be interspersed
with the normal dry-run output. I think that's OK. But another
alternative would be to collect the paths and then print:
warning: In Git 2.0, ...
The following deleted paths were not considered under the current
rule. Use "git add -A" to stage their removal now.
foo
bar
-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html