Allow the default low-level merge driver to be configured.
[gitweb.git] / t / t0020-crlf.sh
index 58a4d86df3f8b82d4a5a7dcabdb93ee62b20a35c..cf84f0a1ab5b392930f1d5a0008530399a6a00f6 100755 (executable)
@@ -180,11 +180,8 @@ test_expect_success 'apply patch (autocrlf=true)' '
        git repo-config core.autocrlf true &&
        git read-tree --reset -u HEAD &&
 
-       # Sore thumb
-       remove_cr one >tmp && mv -f tmp one &&
-
        git apply patch.file &&
-       test "$patched" = "`git hash-object --stdin <one`" || {
+       test "$patched" = "`remove_cr one | git hash-object --stdin`" || {
                echo "Eh?  apply without index"
                false
        }
@@ -203,4 +200,42 @@ test_expect_success 'apply patch --cached (autocrlf=true)' '
        }
 '
 
+test_expect_success 'apply patch --index (autocrlf=true)' '
+
+       rm -f tmp one dir/two &&
+       git repo-config core.autocrlf true &&
+       git read-tree --reset -u HEAD &&
+
+       git apply --index patch.file &&
+       test "$patched" = `git rev-parse :one` &&
+       test "$patched" = "`remove_cr one | git hash-object --stdin`" || {
+               echo "Eh?  apply with --index"
+               false
+       }
+'
+
+test_expect_success '.gitattributes says two is binary' '
+
+       echo "two -crlf" >.gitattributes &&
+       rm -f tmp one dir/two &&
+       git repo-config core.autocrlf true &&
+       git read-tree --reset -u HEAD &&
+
+       if remove_cr dir/two >/dev/null
+       then
+               echo "Huh?"
+               false
+       else
+               : happy
+       fi &&
+
+       if remove_cr one >/dev/null
+       then
+               : happy
+       else
+               echo "Huh?"
+               false
+       fi
+'
+
 test_done