From: Junio C Hamano Date: Fri, 26 Apr 2013 20:44:35 +0000 (-0700) Subject: git add: avoid "-u/-A without pathspec" warning on stat-dirty paths X-Git-Tag: v1.8.3-rc0~16^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0df7b8e55c3b193f2b2f60f7cac1ebb2ce04cd9e;p=thirdparty%2Fgit.git 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 Acked-by: Jonathan Nieder --- 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;