summaryrefslogtreecommitdiff
path: root/builtin-diff-index.c
diff options
context:
space:
mode:
authorWincent Colaiuta <win@wincent.com>2007-12-13 20:24:52 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-12-14 07:05:42 (GMT)
commit62c64895cfcf3bbf34969a69fa96a631f7d5b14e (patch)
treeba4176915a9320356f245f401913d2bfa9992b43 /builtin-diff-index.c
parent913b45f51b151d8e29f86df67d3e10853d831470 (diff)
downloadgit-62c64895cfcf3bbf34969a69fa96a631f7d5b14e.zip
git-62c64895cfcf3bbf34969a69fa96a631f7d5b14e.tar.gz
git-62c64895cfcf3bbf34969a69fa96a631f7d5b14e.tar.bz2
"diff --check" should affect exit status
"git diff" has a --check option that can be used to check for whitespace problems but it only reported by printing warnings to the console. Now when the --check option is used we give a non-zero exit status, making "git diff --check" nicer to use in scripts and hooks. Signed-off-by: Wincent Colaiuta <win@wincent.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-diff-index.c')
-rw-r--r--builtin-diff-index.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin-diff-index.c b/builtin-diff-index.c
index 556c506..532b284 100644
--- a/builtin-diff-index.c
+++ b/builtin-diff-index.c
@@ -46,5 +46,7 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
result = run_diff_index(&rev, cached);
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;
}