aboutsummaryrefslogtreecommitdiff
path: root/builtin/add.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-04-26 13:44:35 -0700
committerJunio C Hamano <gitster@pobox.com>2013-04-26 14:55:20 -0700
commit0df7b8e55c3b193f2b2f60f7cac1ebb2ce04cd9e (patch)
treef21b94f9566eb2b1ad09c9a152422dd13441f920 /builtin/add.c
parentde91daf5e6c9346a54ec8afd331017470d280b12 (diff)
downloadgit-0df7b8e55c3b193f2b2f60f7cac1ebb2ce04cd9e.tar.gz
git-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/add.c')
-rw-r--r--builtin/add.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/add.c b/builtin/add.c
index daf02c6af..44db04aa1 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;