aboutsummaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-06-26 13:16:33 -0700
committerJunio C Hamano <gitster@pobox.com>2008-06-26 13:26:25 -0700
commit18374e584ca7a820457c1d83ee99867c216e7b75 (patch)
tree4745a5ec231cc46b28fd4531e9b71a5476606fed /diff.c
parente636106c76e0273334940d899de1c928d08b29e8 (diff)
downloadgit-18374e584ca7a820457c1d83ee99867c216e7b75.tar.gz
git-18374e584ca7a820457c1d83ee99867c216e7b75.tar.xz
diff --check: do not discard error status upon seeing a good line
"git diff --check" should return non-zero when there was any whitespace error but the code only paid attention to the error status of the last new line in the patch. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/diff.c b/diff.c
index 526249008..f281c5b82 100644
--- a/diff.c
+++ b/diff.c
@@ -1150,12 +1150,14 @@ static void checkdiff_consume(void *priv, char *line, unsigned long len)
char *err;
if (line[0] == '+') {
+ unsigned bad;
data->lineno++;
- data->status = check_and_emit_line(line + 1, len - 1,
+ bad = check_and_emit_line(line + 1, len - 1,
data->ws_rule, NULL, NULL, NULL, NULL);
- if (!data->status)
+ if (!bad)
return;
- err = whitespace_error_string(data->status);
+ data->status |= bad;
+ err = whitespace_error_string(bad);
fprintf(data->file, "%s:%d: %s.\n", data->filename, data->lineno, err);
free(err);
emit_line(data->file, set, reset, line, 1);