When diff.autorefreshindex is true, if a file has merely been 'touched' (mtime changed, but contents unchanged), then `git-diff --quiet' will now return 0 (indicating no change) instead of 1, and also silently refresh the index. Signed-off-by: Karl Chen <quarl@xxxxxxxxx> --- In current git master: git init echo abc > file1 git add file1 git commit -m msg sleep 1; touch file1 git diff --exit-code --quiet file1 echo $? # 1 [I expected 0] git diff --exit-code file1 echo $? # 0 [as expected] git diff --exit-code --quiet file1 echo $? # 0 [the non-quiet diff refreshed the cache] I think `git diff --quiet file1' should return 0 when file1 only differs by mtime. I got this to work by having diffcore_std() call diffcore_skip_stat_unmatch() even when --quiet is specified. (I'm not sure about interaction with the other options.) diff.c | 34 ++++++++++++++++++---------------- 1 files changed, 18 insertions(+), 16 deletions(-) diff --git a/diff.c b/diff.c index 135dec4..986cec3 100644 --- a/diff.c +++ b/diff.c @@ -3386,22 +3386,24 @@ static void diffcore_skip_stat_unmatch(struct diff_options *diffopt) void diffcore_std(struct diff_options *options) { - if (DIFF_OPT_TST(options, QUIET)) - return; - - if (options->skip_stat_unmatch && !DIFF_OPT_TST(options, FIND_COPIES_HARDER)) - diffcore_skip_stat_unmatch(options); - if (options->break_opt != -1) - diffcore_break(options->break_opt); - if (options->detect_rename) - diffcore_rename(options); - if (options->break_opt != -1) - diffcore_merge_broken(); - if (options->pickaxe) - diffcore_pickaxe(options->pickaxe, options->pickaxe_opts); - if (options->orderfile) - diffcore_order(options->orderfile); - diff_resolve_rename_copy(); + if (DIFF_OPT_TST(options, QUIET)) { + if (options->skip_stat_unmatch) + diffcore_skip_stat_unmatch(options); + } else { + if (options->skip_stat_unmatch && !DIFF_OPT_TST(options, FIND_COPIES_HARDER)) + diffcore_skip_stat_unmatch(options); + if (options->break_opt != -1) + diffcore_break(options->break_opt); + if (options->detect_rename) + diffcore_rename(options); + if (options->break_opt != -1) + diffcore_merge_broken(); + if (options->pickaxe) + diffcore_pickaxe(options->pickaxe, options->pickaxe_opts); + if (options->orderfile) + diffcore_order(options->orderfile); + diff_resolve_rename_copy(); + } diffcore_apply_filter(options->filter); if (diff_queued_diff.nr) -- 1.5.6.3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html