Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-09-04 13:25:57 +0400
committerJunio C Hamano <gitster@pobox.com>2009-09-04 22:50:26 +0400
commit94ea026b358f9fd5395d9344a80f2d5a50e93e1f (patch)
treebbb48ff8199ac4687ebda43b0639b93be7145422 /builtin-apply.c
parent77b15bbd88e2f48de093ff0e60de6dbc11e3329e (diff)
apply --whitespace: warn blank but not necessarily empty lines at EOF
The whitespace error of adding blank lines at the end of file should trigger if you added a non-empty line at the end, if the contents of the line is full of whitespaces. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-apply.c')
-rw-r--r--builtin-apply.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin-apply.c b/builtin-apply.c
index 37d3bc069b..6662cc438c 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -1957,7 +1957,8 @@ static int apply_one_fragment(struct image *img, struct fragment *frag,
is_blank_context = 1;
break;
case ' ':
- if (plen && patch[1] == '\n')
+ if (plen && (ws_rule & WS_BLANK_AT_EOF) &&
+ ws_blank_line(patch + 1, plen, ws_rule))
is_blank_context = 1;
case '-':
memcpy(old, patch + 1, plen);
@@ -1985,7 +1986,8 @@ static int apply_one_fragment(struct image *img, struct fragment *frag,
(first == '+' ? 0 : LINE_COMMON));
new += added;
if (first == '+' &&
- added == 1 && new[-1] == '\n')
+ (ws_rule & WS_BLANK_AT_EOF) &&
+ ws_blank_line(patch + 1, plen, ws_rule))
added_blank_line = 1;
break;
case '@': case '\\':