diff options
| author | Junio C Hamano <gitster@pobox.com> | 2007-12-14 21:42:53 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2007-12-14 21:42:53 -0800 |
| commit | dfaf75b4698833d820e77e9f42ef93f3b6d3669d (patch) | |
| tree | af298a982053033eab62dcff0650d3eb18b37cc6 /builtin-diff-tree.c | |
| parent | d7e92806cdc5ca78c4db879c68f91c70ff9e1ade (diff) | |
| parent | 5973a07937f2c64b595c6784b06eb4441c07b5ef (diff) | |
| download | git-dfaf75b4698833d820e77e9f42ef93f3b6d3669d.tar.gz | |
Merge branch 'wc/diff'
* wc/diff:
Test interaction between diff --check and --exit-code
Use shorter error messages for whitespace problems
Add tests for "git diff --check" with core.whitespace options
Make "diff --check" output match "git apply"
Unify whitespace checking
diff --check: minor fixups
"diff --check" should affect exit status
Diffstat (limited to 'builtin-diff-tree.c')
| -rw-r--r-- | builtin-diff-tree.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/builtin-diff-tree.c b/builtin-diff-tree.c index 2e13716eec..ebc50efbd2 100644 --- a/builtin-diff-tree.c +++ b/builtin-diff-tree.c @@ -117,23 +117,21 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix) break; } - if (!read_stdin) - return DIFF_OPT_TST(&opt->diffopt, EXIT_WITH_STATUS) - && DIFF_OPT_TST(&opt->diffopt, HAS_CHANGES); + if (read_stdin) { + if (opt->diffopt.detect_rename) + opt->diffopt.setup |= (DIFF_SETUP_USE_SIZE_CACHE | + DIFF_SETUP_USE_CACHE); + while (fgets(line, sizeof(line), stdin)) { + unsigned char sha1[20]; - if (opt->diffopt.detect_rename) - opt->diffopt.setup |= (DIFF_SETUP_USE_SIZE_CACHE | - DIFF_SETUP_USE_CACHE); - while (fgets(line, sizeof(line), stdin)) { - unsigned char sha1[20]; - - if (get_sha1_hex(line, sha1)) { - fputs(line, stdout); - fflush(stdout); + if (get_sha1_hex(line, sha1)) { + fputs(line, stdout); + fflush(stdout); + } + else + diff_tree_stdin(line); } - else - diff_tree_stdin(line); } - return DIFF_OPT_TST(&opt->diffopt, EXIT_WITH_STATUS) - && DIFF_OPT_TST(&opt->diffopt, HAS_CHANGES); + + return diff_result_code(&opt->diffopt, 0); } |
