summaryrefslogtreecommitdiff
path: root/t/t4015-diff-whitespace.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-08-20 11:47:55 -0700
committerJunio C Hamano <gitster@pobox.com>2008-08-20 13:28:19 -0700
commitc35539eb10b0ab2a180e523f03ff65dc061bd47e (patch)
tree2b45033cc208e7edd75dd4a2b5803d5eabd774c7 /t/t4015-diff-whitespace.sh
parentc71e917975ecd5fdc4caef245cf18b244213e3f6 (diff)
downloadgit-c35539eb10b0ab2a180e523f03ff65dc061bd47e.tar.gz
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 't/t4015-diff-whitespace.sh')
-rwxr-xr-xt/t4015-diff-whitespace.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index a27fccc8dc..ec98509fd2 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -341,4 +341,15 @@ test_expect_success 'checkdiff detects trailing blank lines' '
git diff --check | grep "ends with blank"
'
+test_expect_success 'checkdiff allows new blank lines' '
+ git checkout x &&
+ mv x y &&
+ (
+ echo "/* This is new */" &&
+ echo "" &&
+ cat y
+ ) >x &&
+ git diff --check
+'
+
test_done