summaryrefslogtreecommitdiff
path: root/t/t7607-merge-overwrite.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-11-24 15:55:36 -0800
committerJunio C Hamano <gitster@pobox.com>2010-11-24 15:55:36 -0800
commit7d43de925b2771d295d8fc4341b7bd544e2a74fa (patch)
tree06cd429ed1ed04337eeaf23f6d72855fd94d3c0b /t/t7607-merge-overwrite.sh
parent01530432f73e7a29fbb9c4bc62aa88fba125ca7d (diff)
parent172b6428d06ff4eb0812f087a497d50b6c878fe1 (diff)
downloadgit-7d43de925b2771d295d8fc4341b7bd544e2a74fa.tar.gz
Merge branch 'cb/maint-orphan-merge-noclobber'
* cb/maint-orphan-merge-noclobber: do not overwrite untracked during merge from unborn branch
Diffstat (limited to 't/t7607-merge-overwrite.sh')
-rwxr-xr-xt/t7607-merge-overwrite.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/t/t7607-merge-overwrite.sh b/t/t7607-merge-overwrite.sh
index d82349a6a8..3988900fc3 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