X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft7607-merge-overwrite.sh;h=3988900fc33f0f5f9cdd416096df619aec2d577e;hb=5acb623b72bde9ec96c48a8bb8f50e61371705ee;hp=d82349a6a8d6c12c3ca4398a18bd6c1dd42efdc9;hpb=d25c72f7da5116f7b7a1f88a59d2bc14415a03b2;p=git.git diff --git a/t/t7607-merge-overwrite.sh b/t/t7607-merge-overwrite.sh index d82349a6a..3988900fc 100755 --- a/t/t7607-merge-overwrite.sh +++ b/t/t7607-merge-overwrite.sh @@ -84,4 +84,20 @@ test_expect_success 'will not overwrite removed file with staged changes' ' test_cmp important c1.c ' +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