Skip to content

Commit 58f4d1b

Browse files
newrengitster
authored andcommitted
t6044: verify that merges expected to abort actually abort
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1b9fbef commit 58f4d1b

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

t/t6044-merge-unrelated-index-changes.sh

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ test_expect_success 'ff update, important file modified' '
8282
touch subdir/e &&
8383
git add subdir/e &&
8484
85-
test_must_fail git merge E^0
85+
test_must_fail git merge E^0 &&
86+
test_path_is_missing .git/MERGE_HEAD
8687
'
8788

8889
test_expect_success 'resolve, trivial' '
@@ -91,7 +92,8 @@ test_expect_success 'resolve, trivial' '
9192
9293
touch random_file && git add random_file &&
9394
94-
test_must_fail git merge -s resolve C^0
95+
test_must_fail git merge -s resolve C^0 &&
96+
test_path_is_missing .git/MERGE_HEAD
9597
'
9698

9799
test_expect_success 'resolve, non-trivial' '
@@ -100,7 +102,8 @@ test_expect_success 'resolve, non-trivial' '
100102
101103
touch random_file && git add random_file &&
102104
103-
test_must_fail git merge -s resolve D^0
105+
test_must_fail git merge -s resolve D^0 &&
106+
test_path_is_missing .git/MERGE_HEAD
104107
'
105108

106109
test_expect_success 'recursive' '
@@ -109,16 +112,18 @@ test_expect_success 'recursive' '
109112
110113
touch random_file && git add random_file &&
111114
112-
test_must_fail git merge -s recursive C^0
115+
test_must_fail git merge -s recursive C^0 &&
116+
test_path_is_missing .git/MERGE_HEAD
113117
'
114118

115-
test_expect_success 'recursive, when merge branch matches merge base' '
119+
test_expect_failure 'recursive, when merge branch matches merge base' '
116120
git reset --hard &&
117121
git checkout B^0 &&
118122
119123
touch random_file && git add random_file &&
120124
121-
test_must_fail git merge -s recursive F^0
125+
test_must_fail git merge -s recursive F^0 &&
126+
test_path_is_missing .git/MERGE_HEAD
122127
'
123128

124129
test_expect_success 'octopus, unrelated file touched' '
@@ -127,7 +132,8 @@ test_expect_success 'octopus, unrelated file touched' '
127132
128133
touch random_file && git add random_file &&
129134
130-
test_must_fail git merge C^0 D^0
135+
test_must_fail git merge C^0 D^0 &&
136+
test_path_is_missing .git/MERGE_HEAD
131137
'
132138

133139
test_expect_success 'octopus, related file removed' '
@@ -136,7 +142,8 @@ test_expect_success 'octopus, related file removed' '
136142
137143
git rm b &&
138144
139-
test_must_fail git merge C^0 D^0
145+
test_must_fail git merge C^0 D^0 &&
146+
test_path_is_missing .git/MERGE_HEAD
140147
'
141148

142149
test_expect_success 'octopus, related file modified' '
@@ -145,7 +152,8 @@ test_expect_success 'octopus, related file modified' '
145152
146153
echo 12 >>a && git add a &&
147154
148-
test_must_fail git merge C^0 D^0
155+
test_must_fail git merge C^0 D^0 &&
156+
test_path_is_missing .git/MERGE_HEAD
149157
'
150158

151159
test_expect_success 'ours' '
@@ -154,7 +162,8 @@ test_expect_success 'ours' '
154162
155163
touch random_file && git add random_file &&
156164
157-
test_must_fail git merge -s ours C^0
165+
test_must_fail git merge -s ours C^0 &&
166+
test_path_is_missing .git/MERGE_HEAD
158167
'
159168

160169
test_expect_success 'subtree' '
@@ -163,7 +172,8 @@ test_expect_success 'subtree' '
163172
164173
touch random_file && git add random_file &&
165174
166-
test_must_fail git merge -s subtree E^0
175+
test_must_fail git merge -s subtree E^0 &&
176+
test_path_is_missing .git/MERGE_HEAD
167177
'
168178

169179
test_done

0 commit comments

Comments
 (0)