Merge branch 'maint-1.8.5' into maint-1.9
[gitweb.git] / t / t4020-diff-external.sh
index bcae35ac1c93aaf79032db5ee09fd2d3400101f5..044620186d135fe5caeb9376665305af1c8acbe5 100755 (executable)
@@ -226,12 +226,13 @@ keep_only_cr () {
 }
 
 test_expect_success 'external diff with autocrlf = true' '
-       git config core.autocrlf true &&
+       test_config core.autocrlf true &&
        GIT_EXTERNAL_DIFF=./fake-diff.sh git diff &&
        test $(wc -l < crlfed.txt) = $(cat crlfed.txt | keep_only_cr | wc -c)
 '
 
 test_expect_success 'diff --cached' '
+       test_config core.autocrlf true &&
        git add file &&
        git update-index --assume-unchanged file &&
        echo second >file &&
@@ -239,4 +240,31 @@ test_expect_success 'diff --cached' '
        test_cmp "$TEST_DIRECTORY"/t4020/diff.NUL actual
 '
 
+test_expect_success 'clean up crlf leftovers' '
+       git update-index --no-assume-unchanged file &&
+       rm -f file* &&
+       git reset --hard
+'
+
+test_expect_success 'submodule diff' '
+       git init sub &&
+       ( cd sub && test_commit sub1 ) &&
+       git add sub &&
+       test_tick &&
+       git commit -m "add submodule" &&
+       ( cd sub && test_commit sub2 ) &&
+       write_script gather_pre_post.sh <<-\EOF &&
+       echo "$1 $4" # path, mode
+       cat "$2" # old file
+       cat "$5" # new file
+       EOF
+       GIT_EXTERNAL_DIFF=./gather_pre_post.sh git diff >actual &&
+       cat >expected <<-EOF &&
+       sub 160000
+       Subproject commit $(git rev-parse HEAD:sub)
+       Subproject commit $(cd sub && git rev-parse HEAD)
+       EOF
+       test_cmp expected actual
+'
+
 test_done