summaryrefslogtreecommitdiff
path: root/builtin-diff-files.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-12-14 07:40:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-12-14 07:40:27 (GMT)
commitda31b358fb39b32622c14343ffe157a765f3948b (patch)
treef995bc40d7685b5d342e9d60a99a4152a55cf2cd /builtin-diff-files.c
parent62c64895cfcf3bbf34969a69fa96a631f7d5b14e (diff)
downloadgit-da31b358fb39b32622c14343ffe157a765f3948b.zip
git-da31b358fb39b32622c14343ffe157a765f3948b.tar.gz
git-da31b358fb39b32622c14343ffe157a765f3948b.tar.bz2
diff --check: minor fixups
There is no reason --exit-code and --check-diff must be mutually exclusive, so assign different bits to different results and allow them to be returned from the command. Introduce diff_result_code() to factor out the common code to decide final status code based on diffopt settings and use it everywhere. Update tests to match the above fix. Turning pager off when "diff --check" is used is a regression. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-diff-files.c')
-rw-r--r--builtin-diff-files.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/builtin-diff-files.c b/builtin-diff-files.c
index 4afc872..9c04111 100644
--- a/builtin-diff-files.c
+++ b/builtin-diff-files.c
@@ -31,9 +31,5 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
if (!rev.diffopt.output_format)
rev.diffopt.output_format = DIFF_FORMAT_RAW;
result = run_diff_files_cmd(&rev, argc, argv);
- if (DIFF_OPT_TST(&rev.diffopt, EXIT_WITH_STATUS))
- return DIFF_OPT_TST(&rev.diffopt, HAS_CHANGES) != 0;
- if (rev.diffopt.output_format & DIFF_FORMAT_CHECKDIFF)
- return DIFF_OPT_TST(&rev.diffopt, CHECK_FAILED) != 0;
- return result;
+ return diff_result_code(&rev.diffopt, result);
}