diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-04-26 13:44:35 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-04-26 14:55:20 -0700 |
commit | 0df7b8e55c3b193f2b2f60f7cac1ebb2ce04cd9e (patch) | |
tree | f21b94f9566eb2b1ad09c9a152422dd13441f920 /builtin | |
parent | Merge branch 'jn/add-2.0-u-A-sans-pathspec' (early part) (diff) | |
download | tgif-0df7b8e55c3b193f2b2f60f7cac1ebb2ce04cd9e.tar.xz |
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>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/add.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/add.c b/builtin/add.c index daf02c6aff..44db04aa10 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -495,6 +495,8 @@ int cmd_add(int argc, const char **argv, const char *prefix) refresh(verbose, pathspec); goto finish; } + if (implicit_dot && prefix) + refresh_cache(REFRESH_QUIET); if (pathspec) { int i; |