Skip to content

Commit c94bf41

Browse files
author
Junio C Hamano
committed
git-apply: what is detected and fixed is not just trailing spaces.
But we kept saying "trailing whitespace" all the same. Reword the error messages a bit. Signed-off-by: Junio C Hamano <[email protected]>
1 parent d3017e9 commit c94bf41

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

builtin-apply.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static enum whitespace_eol {
5555
} new_whitespace = warn_on_whitespace;
5656
static int whitespace_error;
5757
static int squelch_whitespace_errors = 5;
58-
static int applied_after_stripping;
58+
static int applied_after_fixing_ws;
5959
static const char *patch_input_file;
6060

6161
static void parse_whitespace_option(const char *option)
@@ -1657,7 +1657,7 @@ static int apply_line(char *output, const char *patch, int plen)
16571657
if (add_nl_to_tail)
16581658
output[plen++] = '\n';
16591659
if (fixed)
1660-
applied_after_stripping++;
1660+
applied_after_fixing_ws++;
16611661
return output + plen - buf;
16621662
}
16631663

@@ -2884,18 +2884,17 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
28842884
squelched == 1 ? "" : "s");
28852885
}
28862886
if (new_whitespace == error_on_whitespace)
2887-
die("%d line%s add%s trailing whitespaces.",
2887+
die("%d line%s add%s whitespace errors.",
28882888
whitespace_error,
28892889
whitespace_error == 1 ? "" : "s",
28902890
whitespace_error == 1 ? "s" : "");
2891-
if (applied_after_stripping)
2891+
if (applied_after_fixing_ws)
28922892
fprintf(stderr, "warning: %d line%s applied after"
2893-
" stripping trailing whitespaces.\n",
2894-
applied_after_stripping,
2895-
applied_after_stripping == 1 ? "" : "s");
2893+
" fixing whitespace errors.\n",
2894+
applied_after_fixing_ws,
2895+
applied_after_fixing_ws == 1 ? "" : "s");
28962896
else if (whitespace_error)
2897-
fprintf(stderr, "warning: %d line%s add%s trailing"
2898-
" whitespaces.\n",
2897+
fprintf(stderr, "warning: %d line%s add%s whitespace errors.\n",
28992898
whitespace_error,
29002899
whitespace_error == 1 ? "" : "s",
29012900
whitespace_error == 1 ? "s" : "");

0 commit comments

Comments
 (0)