Imported Upstream version 2.27.0
[platform/upstream/git.git] / t / t7607-merge-overwrite.sh
index 1c59349..dd8ab7e 100755 (executable)
@@ -92,12 +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' '
+test_expect_success '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_must_fail git merge c1a >out &&
+       test_i18ngrep "Refusing to lose dirty file at other.c" out &&
+       test_path_is_file other.c~HEAD &&
+       test $(git hash-object other.c~HEAD) = $(git rev-parse c1a:c1.c) &&
        test_cmp important other.c
 '
 
@@ -125,7 +128,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 &&