diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-02-15 20:30:05 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-02-15 23:06:57 -0800 |
commit | 0ef617f4b6ea78ad63dd11e90f8c854238176981 (patch) | |
tree | db20846573f6e5c91d75a99041ce796d8005d0f6 /diff.c | |
parent | 13bf1a99764ea751f6fa75502309d8b91529623a (diff) | |
download | git-0ef617f4b6ea78ad63dd11e90f8c854238176981.tar.gz git-0ef617f4b6ea78ad63dd11e90f8c854238176981.tar.xz |
diff: Fix miscounting of --check output
c1795bb (Unify whitespace checking) incorrectly made the
checking function return without incrementing the line numbers
when there is no whitespace problem is found on a '+' line.
This resurrects the earlier behaviour.
Noticed and reported by Jay Soffian. The test script was stolen
from Jay's independent fix.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r-- | diff.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1013,6 +1013,7 @@ static void checkdiff_consume(void *priv, char *line, unsigned long len) char *err; if (line[0] == '+') { + data->lineno++; data->status = check_and_emit_line(line + 1, len - 1, data->ws_rule, NULL, NULL, NULL, NULL); if (!data->status) @@ -1023,13 +1024,12 @@ static void checkdiff_consume(void *priv, char *line, unsigned long len) emit_line(set, reset, line, 1); (void)check_and_emit_line(line + 1, len - 1, data->ws_rule, stdout, set, reset, ws); - data->lineno++; } else if (line[0] == ' ') data->lineno++; else if (line[0] == '@') { char *plus = strchr(line, '+'); if (plus) - data->lineno = strtol(plus, NULL, 10); + data->lineno = strtol(plus, NULL, 10) - 1; else die("invalid diff"); } |