summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-08-31 20:13:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-09-01 06:30:14 (GMT)
commitaecbf914c43ab76e055fa8a25b12456ae74d91bc (patch)
tree92d91c10b55a5e54ed598acd1f0d58f8f35b1533 /diff.c
parent18e32b5b7af4175f852469159d004a2a8de64658 (diff)
downloadgit-aecbf914c43ab76e055fa8a25b12456ae74d91bc.zip
git-aecbf914c43ab76e055fa8a25b12456ae74d91bc.tar.gz
git-aecbf914c43ab76e055fa8a25b12456ae74d91bc.tar.bz2
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 <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index a7e7671..0d30d05 100644
--- a/diff.c
+++ b/diff.c
@@ -19,6 +19,7 @@
static int diff_detect_rename_default;
static int diff_rename_limit_default = -1;
static int diff_use_color_default;
+int diff_auto_refresh_index = 1;
static char diff_colors[][COLOR_MAXLEN] = {
"\033[m", /* reset */
@@ -166,6 +167,10 @@ int git_diff_ui_config(const char *var, const char *value)
diff_detect_rename_default = DIFF_DETECT_RENAME;
return 0;
}
+ if (!strcmp(var, "diff.autorefreshindex")) {
+ diff_auto_refresh_index = git_config_bool(var, value);
+ return 0;
+ }
if (!prefixcmp(var, "diff.")) {
const char *ep = strrchr(var, '.');