Imported Upstream version 2.12.1
[platform/upstream/git.git] / t / t7607-merge-overwrite.sh
index aa74184..9444d6a 100755 (executable)
@@ -92,6 +92,15 @@ test_expect_success 'will not overwrite removed file with staged changes' '
        test_cmp important c1.c
 '
 
+test_expect_failure 'will not overwrite unstaged changes in renamed file' '
+       git reset --hard c1 &&
+       git mv c1.c other.c &&
+       git commit -m rename &&
+       cp important other.c &&
+       git merge c1a &&
+       test_cmp important other.c
+'
+
 test_expect_success 'will not overwrite untracked subtree' '
        git reset --hard c0 &&
        rm -rf sub &&
@@ -106,7 +115,7 @@ cat >expect <<\EOF
 error: The following untracked working tree files would be overwritten by merge:
        sub
        sub2
-Please move or remove them before you can merge.
+Please move or remove them before you merge.
 Aborting
 EOF
 
@@ -116,7 +125,7 @@ test_expect_success 'will not overwrite untracked file in leading path' '
        cp important sub &&
        cp important sub2 &&
        test_must_fail git merge sub 2>out &&
-       test_cmp out expect &&
+       test_i18ncmp out expect &&
        test_path_is_missing .git/MERGE_HEAD &&
        test_cmp important sub &&
        test_cmp important sub2 &&
@@ -132,11 +141,10 @@ test_expect_success SYMLINKS 'will not overwrite untracked symlink in leading pa
        test_path_is_missing .git/MERGE_HEAD
 '
 
-test_expect_success SYMLINKS 'will not be confused by symlink in leading path' '
+test_expect_success 'will not be confused by symlink in leading path' '
        git reset --hard c0 &&
        rm -rf sub &&
-       ln -s sub2 sub &&
-       git add sub &&
+       test_ln_s_add sub2 sub &&
        git commit -m ln &&
        git checkout sub
 '