Skip to content

Commit

Permalink
Use shorter error messages for whitespace problems
Browse files Browse the repository at this point in the history
The initial version of the whitespace_error_string() function took the
messages from builtin-apply.c rather than the shorter messages from
diff.c.

This commit addresses Junio's concern that these messages might be too
long (now that we can emit multiple warnings per line).

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Wincent Colaiuta authored and Junio C Hamano committed Dec 15, 2007
1 parent f817546 commit 420f4f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion t/t4015-diff-whitespace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ test_expect_success 'check mixed spaces and tabs in indent' '
# This is indented with SP HT SP.
echo " foo();" > x &&
git diff --check | grep "Space in indent is followed by a tab"
git diff --check | grep "space before tab in indent"
'

Expand Down
6 changes: 3 additions & 3 deletions ws.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,16 @@ char *whitespace_error_string(unsigned ws)
struct strbuf err;
strbuf_init(&err, 0);
if (ws & WS_TRAILING_SPACE)
strbuf_addstr(&err, "Adds trailing whitespace");
strbuf_addstr(&err, "trailing whitespace");
if (ws & WS_SPACE_BEFORE_TAB) {
if (err.len)
strbuf_addstr(&err, ", ");
strbuf_addstr(&err, "Space in indent is followed by a tab");
strbuf_addstr(&err, "space before tab in indent");
}
if (ws & WS_INDENT_WITH_NON_TAB) {
if (err.len)
strbuf_addstr(&err, ", ");
strbuf_addstr(&err, "Indent more than 8 places with spaces");
strbuf_addstr(&err, "indent with spaces");
}
return strbuf_detach(&err, NULL);
}
Expand Down

0 comments on commit 420f4f0

Please sign in to comment.