summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c71e917)
raw | patch | inline | side by side (parent: c71e917)
author | Junio C Hamano <gitster@pobox.com> | |
Wed, 20 Aug 2008 18:47:55 +0000 (11:47 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 20 Aug 2008 20:28:19 +0000 (13:28 -0700) |
The code remembered that the last diff output it saw was an empty line,
and tried to reset that state whenever it sees a context line, a non-blank
new line, or a new hunk. However, this codepath asks the underlying diff
engine to feed diff without any context, and the "just saw an empty line"
state was not reset if you added a new blank line in the last hunk of your
patch, even if it is not the last line of the file.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
and tried to reset that state whenever it sees a context line, a non-blank
new line, or a new hunk. However, this codepath asks the underlying diff
engine to feed diff without any context, and the "just saw an empty line"
state was not reset if you added a new blank line in the last hunk of your
patch, even if it is not the last line of the file.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c | patch | blob | history | |
t/t4015-diff-whitespace.sh | patch | blob | history |
index bf5d5f15a3b54f1e1a0a2068990e899fd869d435..f70e6b4912911bd3f3a1d385fce7119a4a8107f6 100644 (file)
--- a/diff.c
+++ b/diff.c
xdemitcb_t ecb;
memset(&xecfg, 0, sizeof(xecfg));
+ xecfg.ctxlen = 1; /* at least one context line */
xpp.flags = XDF_NEED_MINIMAL;
ecb.outf = xdiff_outf;
ecb.priv = &data;
index a27fccc8dce431169ce41f7137fb75f44149719c..ec98509fd2144121e599edd6a85217840041f321 100755 (executable)
git diff --check | grep "ends with blank"
'
+test_expect_success 'checkdiff allows new blank lines' '
+ git checkout x &&
+ mv x y &&
+ (
+ echo "/* This is new */" &&
+ echo "" &&
+ cat y
+ ) >x &&
+ git diff --check
+'
+
test_done