From: Junio C Hamano Date: Mon, 15 Nov 2010 19:02:14 +0000 (-0800) Subject: Merge branch 'cb/maint-orphan-merge-noclobber' into next X-Git-Tag: ko-next~152 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=046c5e572bcb5cc0d59641ddcf472eb2f4a44652;p=git.git Merge branch 'cb/maint-orphan-merge-noclobber' into next * cb/maint-orphan-merge-noclobber: do not overwrite untracked during merge from unborn branch Conflicts: t/t7607-merge-overwrite.sh --- 046c5e572bcb5cc0d59641ddcf472eb2f4a44652 diff --cc t/t7607-merge-overwrite.sh index e49dd8023,8317a574c..d4a499dee --- a/t/t7607-merge-overwrite.sh +++ b/t/t7607-merge-overwrite.sh @@@ -90,41 -84,20 +90,57 @@@ test_expect_success 'will not overwrit test_cmp important c1.c ' +test_expect_success 'will not overwrite untracked subtree' ' + git reset --hard c0 && + rm -rf sub && + mkdir -p sub/f && + cp important sub/f/important && + test_must_fail git merge sub && + test_path_is_missing .git/MERGE_HEAD && + test_cmp important sub/f/important +' + +test_expect_success 'will not overwrite untracked file in leading path' ' + git reset --hard c0 && + rm -rf sub && + cp important sub && + test_must_fail git merge sub && + test_path_is_missing .git/MERGE_HEAD && + test_cmp important sub +' + +test_expect_failure SYMLINKS 'will not overwrite untracked symlink in leading path' ' + git reset --hard c0 && + rm -rf sub && + mkdir sub2 && + ln -s sub2 sub && + test_must_fail git merge sub && + test_path_is_missing .git/MERGE_HEAD +' + +test_expect_success SYMLINKS 'will not be confused by symlink in leading path' ' + git reset --hard c0 && + rm -rf sub && + ln -s sub2 sub && + git add sub && + git commit -m ln && + 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