Skip to content

Commit

Permalink
Merge branch 'cm/diff-check-at-eol'
Browse files Browse the repository at this point in the history
* cm/diff-check-at-eol:
  diff --check: correct line numbers of new blank lines at EOF
  • Loading branch information
Junio C Hamano committed Nov 30, 2010
2 parents f565f6e + 8837d33 commit 039e84e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -2158,7 +2158,7 @@ static void builtin_checkdiff(const char *name_a, const char *name_b,

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;
Expand Down
9 changes: 9 additions & 0 deletions t/t4019-diff-wserror.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,15 @@ test_expect_success 'trailing empty lines (2)' '
'

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 &&
Expand Down

0 comments on commit 039e84e

Please sign in to comment.