summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2008-08-20 11:47:55 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2008-08-20 13:28:19 -0700
commitc35539eb10b0ab2a180e523f03ff65dc061bd47e (patch)
tree2b45033cc208e7edd75dd4a2b5803d5eabd774c7 /diff.c
parentremote.c: remove useless if-before-free test (diff)
downloadtgif-c35539eb10b0ab2a180e523f03ff65dc061bd47e.tar.xz
diff --check: do not get confused by new blank lines in the middle
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>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index bf5d5f15a3..f70e6b4912 100644
--- a/diff.c
+++ b/diff.c
@@ -1627,6 +1627,7 @@ static void builtin_checkdiff(const char *name_a, const char *name_b,
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;