Code

advice: Document that they all default to true
[git.git] / t / t7607-merge-overwrite.sh
index 4d5ce4e682c1ea69034c3f7789a8ac0c89b12466..aa74184c31cd6b2bd2e0e566e6805e60eed7aff8 100755 (executable)
@@ -107,6 +107,7 @@ error: The following untracked working tree files would be overwritten by merge:
        sub
        sub2
 Please move or remove them before you can merge.
+Aborting
 EOF
 
 test_expect_success 'will not overwrite untracked file in leading path' '
@@ -122,7 +123,7 @@ test_expect_success 'will not overwrite untracked file in leading path' '
        rm -f sub sub2
 '
 
-test_expect_failure SYMLINKS 'will not overwrite untracked symlink in leading path' '
+test_expect_success SYMLINKS 'will not overwrite untracked symlink in leading path' '
        git reset --hard c0 &&
        rm -rf sub &&
        mkdir sub2 &&
@@ -151,9 +152,33 @@ test_expect_success 'will not overwrite untracked file on unborn branch' '
        git checkout --orphan new &&
        cp important c0.c &&
        test_must_fail git merge c0 2>out &&
-       test_cmp out expect &&
+       test_i18ncmp out expect
+'
+
+test_expect_success 'will not overwrite untracked file on unborn branch .git/MERGE_HEAD sanity etc.' '
+       test_when_finished "rm c0.c" &&
        test_path_is_missing .git/MERGE_HEAD &&
        test_cmp important c0.c
 '
 
+test_expect_success 'failed merge leaves unborn branch in the womb' '
+       test_must_fail git rev-parse --verify HEAD
+'
+
+test_expect_success 'set up unborn branch and content' '
+       git symbolic-ref HEAD refs/heads/unborn &&
+       rm -f .git/index &&
+       echo foo > tracked-file &&
+       git add tracked-file &&
+       echo bar > untracked-file
+'
+
+test_expect_success 'will not clobber WT/index when merging into unborn' '
+       git merge master &&
+       grep foo tracked-file &&
+       git show :tracked-file >expect &&
+       grep foo expect &&
+       grep bar untracked-file
+'
+
 test_done