From aecbf914c43ab76e055fa8a25b12456ae74d91bc Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 31 Aug 2007 13:13:42 -0700 Subject: git-diff: resurrect the traditional empty "diff --git" behaviour The warning message to suggest "Consider running git-status" from "git-diff" that we experimented with during the 1.5.3 cycle turns out to be a bad idea. It robbed cache-dirty information from people who valued it, while still asking users to run "update-index --refresh". It was hoped that the new behaviour would at least have some educational value, but not showing the cache-dirty paths like before meant that the user would not even know easily which paths were cache-dirty, and it made the need to refresh the index look like even more unnecessary chore. This commit reinstates the traditional behaviour, but with a twist. By default, the empty "diff --git" output is totally squelched out from "git diff" output. At the end of the command, it automatically runs "update-index --refresh" as needed, without even bothering the user. In other words, people who do not care about the cache-dirtyness do not even have to see the warning. The traditional behaviour to see the stat-dirty output and to bypassing the overhead of content comparison can be specified by setting the configuration variable diff.autorefreshindex to false. Signed-off-by: Junio C Hamano --- cache.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cache.h') diff --git a/cache.h b/cache.h index c7e00e7b05..70abbd59bf 100644 --- a/cache.h +++ b/cache.h @@ -594,6 +594,9 @@ extern char *convert_to_git(const char *path, const char *src, unsigned long *si extern char *convert_to_working_tree(const char *path, const char *src, unsigned long *sizep); extern void *convert_sha1_file(const char *path, const unsigned char *sha1, unsigned int mode, enum object_type *type, unsigned long *size); +/* diff.c */ +extern int diff_auto_refresh_index; + /* match-trees.c */ void shift_tree(const unsigned char *, const unsigned char *, unsigned char *, int); -- cgit v1.2.1