]> asedeno.scripts.mit.edu Git - git.git/blobdiff - t/t7607-merge-overwrite.sh
Merge branch 'cb/leading-path-removal'
[git.git] / t / t7607-merge-overwrite.sh
index 9137866e1a7d0dfed7dd55f089a0c3ecd420237c..4d5ce4e682c1ea69034c3f7789a8ac0c89b12466 100755 (executable)
@@ -140,4 +140,20 @@ test_expect_success SYMLINKS 'will not be confused by symlink in leading path' '
        git checkout sub
 '
 
+cat >expect <<\EOF
+error: Untracked working tree file 'c0.c' would be overwritten by merge.
+fatal: read-tree failed
+EOF
+
+test_expect_success 'will not overwrite untracked file on unborn branch' '
+       git reset --hard c0 &&
+       git rm -fr . &&
+       git checkout --orphan new &&
+       cp important c0.c &&
+       test_must_fail git merge c0 2>out &&
+       test_cmp out expect &&
+       test_path_is_missing .git/MERGE_HEAD &&
+       test_cmp important c0.c
+'
+
 test_done