t6044: verify that merges expected to abort actually abort
authorElijah Newren <newren@gmail.com>
Sun, 1 Jul 2018 01:24:57 +0000 (18:24 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 3 Jul 2018 20:13:18 +0000 (13:13 -0700)
t6044 has lots of tests for verifying that merge will abort as expected
when there are changes staged before the merge starts. However, it only
checked for non-zero exit code, which could mean that the merge ran to
completion with conflicts. Check that the merge was actually correctly
aborted, i.e. that .git/MERGE_HEAD is not present.

This changes one of the tests from expect_success to expect_failure.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6044-merge-unrelated-index-changes.sh
index 23b86fb9778980ab813d5e252065ebe34fe4736d..f9c2f8179e000d91a0565f9233874d1aaad576fe 100755 (executable)
@@ -82,7 +82,8 @@ test_expect_success 'ff update, important file modified' '
        touch subdir/e &&
        git add subdir/e &&
 
        touch subdir/e &&
        git add subdir/e &&
 
-       test_must_fail git merge E^0
+       test_must_fail git merge E^0 &&
+       test_path_is_missing .git/MERGE_HEAD
 '
 
 test_expect_success 'resolve, trivial' '
 '
 
 test_expect_success 'resolve, trivial' '
@@ -91,7 +92,8 @@ test_expect_success 'resolve, trivial' '
 
        touch random_file && git add random_file &&
 
 
        touch random_file && git add random_file &&
 
-       test_must_fail git merge -s resolve C^0
+       test_must_fail git merge -s resolve C^0 &&
+       test_path_is_missing .git/MERGE_HEAD
 '
 
 test_expect_success 'resolve, non-trivial' '
 '
 
 test_expect_success 'resolve, non-trivial' '
@@ -100,7 +102,8 @@ test_expect_success 'resolve, non-trivial' '
 
        touch random_file && git add random_file &&
 
 
        touch random_file && git add random_file &&
 
-       test_must_fail git merge -s resolve D^0
+       test_must_fail git merge -s resolve D^0 &&
+       test_path_is_missing .git/MERGE_HEAD
 '
 
 test_expect_success 'recursive' '
 '
 
 test_expect_success 'recursive' '
@@ -109,16 +112,18 @@ test_expect_success 'recursive' '
 
        touch random_file && git add random_file &&
 
 
        touch random_file && git add random_file &&
 
-       test_must_fail git merge -s recursive C^0
+       test_must_fail git merge -s recursive C^0 &&
+       test_path_is_missing .git/MERGE_HEAD
 '
 
 '
 
-test_expect_success 'recursive, when merge branch matches merge base' '
+test_expect_failure 'recursive, when merge branch matches merge base' '
        git reset --hard &&
        git checkout B^0 &&
 
        touch random_file && git add random_file &&
 
        git reset --hard &&
        git checkout B^0 &&
 
        touch random_file && git add random_file &&
 
-       test_must_fail git merge -s recursive F^0
+       test_must_fail git merge -s recursive F^0 &&
+       test_path_is_missing .git/MERGE_HEAD
 '
 
 test_expect_success 'octopus, unrelated file touched' '
 '
 
 test_expect_success 'octopus, unrelated file touched' '
@@ -127,7 +132,8 @@ test_expect_success 'octopus, unrelated file touched' '
 
        touch random_file && git add random_file &&
 
 
        touch random_file && git add random_file &&
 
-       test_must_fail git merge C^0 D^0
+       test_must_fail git merge C^0 D^0 &&
+       test_path_is_missing .git/MERGE_HEAD
 '
 
 test_expect_success 'octopus, related file removed' '
 '
 
 test_expect_success 'octopus, related file removed' '
@@ -136,7 +142,8 @@ test_expect_success 'octopus, related file removed' '
 
        git rm b &&
 
 
        git rm b &&
 
-       test_must_fail git merge C^0 D^0
+       test_must_fail git merge C^0 D^0 &&
+       test_path_is_missing .git/MERGE_HEAD
 '
 
 test_expect_success 'octopus, related file modified' '
 '
 
 test_expect_success 'octopus, related file modified' '
@@ -145,7 +152,8 @@ test_expect_success 'octopus, related file modified' '
 
        echo 12 >>a && git add a &&
 
 
        echo 12 >>a && git add a &&
 
-       test_must_fail git merge C^0 D^0
+       test_must_fail git merge C^0 D^0 &&
+       test_path_is_missing .git/MERGE_HEAD
 '
 
 test_expect_success 'ours' '
 '
 
 test_expect_success 'ours' '
@@ -154,7 +162,8 @@ test_expect_success 'ours' '
 
        touch random_file && git add random_file &&
 
 
        touch random_file && git add random_file &&
 
-       test_must_fail git merge -s ours C^0
+       test_must_fail git merge -s ours C^0 &&
+       test_path_is_missing .git/MERGE_HEAD
 '
 
 test_expect_success 'subtree' '
 '
 
 test_expect_success 'subtree' '
@@ -163,7 +172,8 @@ test_expect_success 'subtree' '
 
        touch random_file && git add random_file &&
 
 
        touch random_file && git add random_file &&
 
-       test_must_fail git merge -s subtree E^0
+       test_must_fail git merge -s subtree E^0 &&
+       test_path_is_missing .git/MERGE_HEAD
 '
 
 test_done
 '
 
 test_done