]> asedeno.scripts.mit.edu Git - git.git/blobdiff - t/t4114-apply-typechange.sh
Merge branch 'jc/maint-1.6.0-diff-borrow-carefully'
[git.git] / t / t4114-apply-typechange.sh
index 55334927abb33864a55f8ff49fd0c0c94a3c1769..7dc35dea38b39ebc49c022714779ae07a9c17d88 100755 (executable)
@@ -9,6 +9,13 @@ test_description='git apply should not get confused with type changes.
 
 . ./test-lib.sh
 
+if ! test_have_prereq SYMLINKS
+then
+       say 'Symbolic links not supported, skipping tests.'
+       test_done
+       exit
+fi
+
 test_expect_success 'setup repository and commits' '
        echo "hello world" > foo &&
        echo "hi planet" > bar &&
@@ -25,6 +32,10 @@ test_expect_success 'setup repository and commits' '
        git update-index foo &&
        git commit -m "foo back to file" &&
        git branch foo-back-to-file &&
+       printf "\0" > foo &&
+       git update-index foo &&
+       git commit -m "foo becomes binary" &&
+       git branch foo-becomes-binary &&
        rm -f foo &&
        git update-index --remove foo &&
        mkdir foo &&
@@ -85,6 +96,20 @@ test_expect_success 'symlink becomes file' '
        '
 test_debug 'cat patch'
 
+test_expect_success 'binary file becomes symlink' '
+       git checkout -f foo-becomes-binary &&
+       git diff-tree -p --binary HEAD foo-symlinked-to-bar > patch &&
+       git apply --index < patch
+       '
+test_debug 'cat patch'
+
+test_expect_success 'symlink becomes binary file' '
+       git checkout -f foo-symlinked-to-bar &&
+       git diff-tree -p --binary HEAD foo-becomes-binary > patch &&
+       git apply --index < patch
+       '
+test_debug 'cat patch'
+
 
 test_expect_success 'symlink becomes directory' '
        git checkout -f foo-symlinked-to-bar &&