diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-08-11 22:15:28 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-08-11 22:15:28 -0700 |
commit | 04c6e9e9ca34226db095bbaa1218030f99f0b7c6 (patch) | |
tree | 908b3080f7e373c20805d917bba6c2c2d505da1d /t | |
parent | Merge branch 'maint' (diff) | |
download | tgif-04c6e9e9ca34226db095bbaa1218030f99f0b7c6.tar.xz |
diff --check: do not unconditionally complain about trailing empty lines
Recently "git diff --check" learned to detect new trailing blank lines
just like "git apply --whitespace" does. However this check should not
trigger unconditionally. This patch makes it honor the whitespace
settings from core.whitespace and gitattributes.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t4019-diff-wserror.sh | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/t/t4019-diff-wserror.sh b/t/t4019-diff-wserror.sh index 0d9cbb6261..7eae1f4500 100755 --- a/t/t4019-diff-wserror.sh +++ b/t/t4019-diff-wserror.sh @@ -13,7 +13,8 @@ test_expect_success setup ' echo " HT and SP indent" >>F && echo "With trailing SP " >>F && echo "Carriage ReturnQ" | tr Q "\015" >>F && - echo "No problem" >>F + echo "No problem" >>F && + echo >>F ' @@ -160,4 +161,21 @@ test_expect_success 'with cr-at-eol (attribute)' ' ' +test_expect_success 'trailing empty lines (1)' ' + + rm -f .gitattributes && + test_must_fail git diff --check >output && + grep "ends with blank lines." output && + grep "trailing whitespace" output + +' + +test_expect_success 'trailing empty lines (2)' ' + + echo "F -whitespace" >.gitattributes && + git diff --check >output && + ! test -s output + +' + test_done |