summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 593ce2b)
raw | patch | inline | side by side (parent: 593ce2b)
author | Christoph Mallon <christoph.mallon@gmx.de> | |
Sun, 10 Oct 2010 17:24:06 +0000 (19:24 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 17 Oct 2010 01:57:35 +0000 (18:57 -0700) |
The whitespace check printed the value of the wrong variable, i.e. the
beginning of the block of blank lines at the EOF (possibly absent) in the
old file.
As "git diff --check" is used by users to check their changes before
making a commit, we should point at the line number in the file after
the change.
Signed-off-by: Christoph Mallon <christoph.mallon@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
beginning of the block of blank lines at the EOF (possibly absent) in the
old file.
As "git diff --check" is used by users to check their changes before
making a commit, we should point at the line number in the file after
the change.
Signed-off-by: Christoph Mallon <christoph.mallon@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c | patch | blob | history | |
t/t4019-diff-wserror.sh | patch | blob | history |
index a2d8c7f9a7a3bbfca889dedfbda8d6f351fbf016..38ba98932f5ca7b256d7bf81d3fa3e069f121130 100644 (file)
--- a/diff.c
+++ b/diff.c
ecbdata.ws_rule = data.ws_rule;
check_blank_at_eof(&mf1, &mf2, &ecbdata);
- blank_at_eof = ecbdata.blank_at_eof_in_preimage;
+ blank_at_eof = ecbdata.blank_at_eof_in_postimage;
if (blank_at_eof) {
static char *err;
index f6d1f1ebab406fcd4f405178ec151149754500b0..87df0aeb59ecb22f07454ce08172f8cfa4940591 100755 (executable)
--- a/t/t4019-diff-wserror.sh
+++ b/t/t4019-diff-wserror.sh
'
+test_expect_success 'checkdiff shows correct line number for trailing blank lines' '
+
+ printf "a\nb\n" > G &&
+ git add G &&
+ printf "x\nx\nx\na\nb\nc\n\n" > G &&
+ [ "$(git diff --check -- G)" = "G:7: new blank line at EOF." ]
+
+'
+
test_expect_success 'do not color trailing cr in context' '
git config --unset core.whitespace
rm -f .gitattributes &&