git add: avoid "-u/-A without pathspec" warning on stat-dirty paths
commit0df7b8e55c3b193f2b2f60f7cac1ebb2ce04cd9e
authorJunio C Hamano <gitster@pobox.com>
Fri, 26 Apr 2013 20:44:35 +0000 (26 13:44 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 26 Apr 2013 21:55:20 +0000 (26 14:55 -0700)
treef21b94f9566eb2b1ad09c9a152422dd13441f920
parentde91daf5e6c9346a54ec8afd331017470d280b12
git add: avoid "-u/-A without pathspec" warning on stat-dirty paths

In preparation for Git 2.0, "git add -u/-A" without pathspec checks
all the working tree (not limited to the current directory) and
issues a warning when it finds any path that we might add in Git
2.0, because that would mean the users' fingers need to be trained
to explicitly say "." if they want to keep the current behaviour.

However, the check was incomplete, because "git add" usually does
not refresh the index, considers a path that is stat-dirty but has
contents that is otherwise up-to-date in the index as "we might
add", and relies on that it is a no-op to add the same thing again
via the add_file_to_index() API (which also knows not to say "added"
in verbose mode when this happens).  We do not want to trigger the
warning for a path that is outside the current directory is merely
stat-dirty, as it won't be added in Git 2.0, either.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
builtin/add.c