aboutsummaryrefslogtreecommitdiff
path: root/tree-diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-05-22 12:45:29 -0700
committerJunio C Hamano <gitster@pobox.com>2009-07-29 10:22:39 -0700
commitf245194f9a13d5108c3a59fd4ab1770ae9fd5b65 (patch)
tree54cb9801bccbe837970f2fc0993f45710dae0b40 /tree-diff.c
parent0a53e9ddeaddad63ad106860237bbf53411d11a7 (diff)
downloadgit-f245194f9a13d5108c3a59fd4ab1770ae9fd5b65.tar.gz
git-f245194f9a13d5108c3a59fd4ab1770ae9fd5b65.tar.xz
diff: change semantics of "ignore whitespace" options
Traditionally, the --ignore-whitespace* options have merely meant to tell the diff output routine that some class of differences are not worth showing in the textual diff output, so that the end user has easier time to review the remaining (presumably more meaningful) changes. These options never affected the outcome of the command, given as the exit status when the --exit-code option was in effect (either directly or indirectly). When you have only whitespace changes, however, you might expect git diff -b --exit-code to report that there is _no_ change with zero exit status. Change the semantics of --ignore-whitespace* options to mean more than "omit showing the difference in text". The exit status, when --exit-code is in effect, is computed by checking if we found any differences at the path level, while diff frontends feed filepairs to the diffcore engine. When "ignore whitespace" options are in effect, we defer this determination until the very end of diffcore transformation. We simply do not know until the textual diff is generated, which comes very late in the pipeline. When --quiet is in effect, various diff frontends optimize by breaking out early from the loop that enumerates the filepairs, when we find the first path level difference; when --ignore-whitespace* is used the above change automatically disables this optimization. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'tree-diff.c')
-rw-r--r--tree-diff.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tree-diff.c b/tree-diff.c
index 0459e54d3..7c526d33f 100644
--- a/tree-diff.c
+++ b/tree-diff.c
@@ -286,7 +286,8 @@ int diff_tree(struct tree_desc *t1, struct tree_desc *t2, const char *base, stru
int baselen = strlen(base);
for (;;) {
- if (DIFF_OPT_TST(opt, QUIET) && DIFF_OPT_TST(opt, HAS_CHANGES))
+ if (DIFF_OPT_TST(opt, QUIET) &&
+ DIFF_OPT_TST(opt, HAS_CHANGES))
break;
if (opt->nr_paths) {
skip_uninteresting(t1, base, baselen, opt);