diff options
-rw-r--r-- | diff.c | 8 | ||||
-rwxr-xr-x | t/t4017-diff-retval.sh | 8 |
2 files changed, 13 insertions, 3 deletions
@@ -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); diff --git a/t/t4017-diff-retval.sh b/t/t4017-diff-retval.sh index dc0b7126cc..0d0fb87f57 100755 --- a/t/t4017-diff-retval.sh +++ b/t/t4017-diff-retval.sh @@ -105,4 +105,12 @@ test_expect_success '--check with --no-pager returns 2 for dirty difference' ' ' + +test_expect_success 'check should test not just the last line' ' + echo "" >>a && + git --no-pager diff --check + test $? = 2 + +' + test_done |