summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 90b1994)
raw | patch | inline | side by side (parent: 90b1994)
author | Junio C Hamano <gitster@pobox.com> | |
Wed, 16 Mar 2011 22:46:08 +0000 (15:46 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 16 Mar 2011 22:57:19 +0000 (15:57 -0700) |
The code notices that the caller does not want any detail of the changes
and only wants to know if there is a change or not by specifying --quiet.
And it breaks out of the loop when it knows it already found any change.
When you have a post-process filter (e.g. --diff-filter), however, the
path we found to be different in the previous round and set HAS_CHANGES
bit may end up being uninteresting, and there may be no output at the end.
The optimization needs to be disabled for such case.
Note that the f245194 (diff: change semantics of "ignore whitespace"
options, 2009-05-22) already disables this optimization by refraining
from setting HAS_CHANGES when post-process filters that need to inspect
the contents of the files (e.g. -S, -w) in diff_change() function.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
and only wants to know if there is a change or not by specifying --quiet.
And it breaks out of the loop when it knows it already found any change.
When you have a post-process filter (e.g. --diff-filter), however, the
path we found to be different in the previous round and set HAS_CHANGES
bit may end up being uninteresting, and there may be no output at the end.
The optimization needs to be disabled for such case.
Note that the f245194 (diff: change semantics of "ignore whitespace"
options, 2009-05-22) already disables this optimization by refraining
from setting HAS_CHANGES when post-process filters that need to inspect
the contents of the files (e.g. -S, -w) in diff_change() function.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff-lib.c | patch | blob | history | |
t/t4037-whitespace-status.sh | patch | blob | history |
diff --git a/diff-lib.c b/diff-lib.c
index b7813af614bc62b563201e22fe0e2bceb2d13833..bfa65033734452faae0d5f4365a817f9e35b3e01 100644 (file)
--- a/diff-lib.c
+++ b/diff-lib.c
int changed;
if (DIFF_OPT_TST(&revs->diffopt, QUICK) &&
- DIFF_OPT_TST(&revs->diffopt, HAS_CHANGES))
+ !revs->diffopt.filter &&
+ DIFF_OPT_TST(&revs->diffopt, HAS_CHANGES))
break;
if (!ce_path_match(ce, revs->prune_data))
index a30b03bcf27ba360c3761ade77ddf0ed00600470..abc49348b196cf0fec232b6f2399356e4fe324d5 100755 (executable)
git diff-files -b -p --exit-code
'
+test_expect_success 'diff-files --diff-filter --quiet' '
+ git reset --hard &&
+ rm a/d &&
+ echo x >>b/e &&
+ test_must_fail git diff-files --diff-filter=M --quiet
+'
+
test_done