Code

Merge branch 'bc/maint-diff-hunk-header-fix' into bc/master-diff-hunk-header-fix
[git.git] / t / t4015-diff-whitespace.sh
index a27fccc8dce431169ce41f7137fb75f44149719c..fc2307eaa3b4e8b1481fd7aa5ae0f93d085338af 100755 (executable)
@@ -7,7 +7,7 @@ test_description='Test special whitespace in diff engine.
 
 '
 . ./test-lib.sh
-. ../diff-lib.sh
+. "$TEST_DIRECTORY"/diff-lib.sh
 
 # Ray Lehtiniemi's example
 
@@ -341,4 +341,31 @@ 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_expect_success 'combined diff with autocrlf conversion' '
+
+       git reset --hard &&
+       echo >x hello &&
+       git commit -m "one side" x &&
+       git checkout HEAD^ &&
+       echo >x goodbye &&
+       git commit -m "the other side" x &&
+       git config core.autocrlf true &&
+       test_must_fail git merge master &&
+
+       git diff | sed -e "1,/^@@@/d" >actual &&
+       ! grep "^-" actual
+
+'
+
 test_done