author | Junio C Hamano <gitster@pobox.com> | |
Tue, 30 Nov 2010 01:52:31 +0000 (17:52 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 30 Nov 2010 01:52:31 +0000 (17:52 -0800) |
* cm/diff-check-at-eol:
diff --check: correct line numbers of new blank lines at EOF
diff --check: correct line numbers of new blank lines at EOF
diff.c | patch | blob | history | |
t/t4019-diff-wserror.sh | patch | blob | history |
index c248bc64c57b3206905dd8e6f72a702073a137cc..d156ff252fda8830f75401a6b31f87c03250f775 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 f7c85ec604df5e037990065ab9d3d82d86587076..3fa836f9d3c19f351ce5451049eb191776cbd4a5 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' '
test_might_fail git config --unset core.whitespace &&
rm -f .gitattributes &&