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 <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren committed
Jun 30, 2018 at 18:24 UTC
58f4d1b96152a4838eba5fd865c7fffab392b0de
1 file changed
+21
-11
t/t6044-merge-unrelated-index-changes.sh
+21
-11
@@ -82,7 +82,8 @@ test_expect_success 'ff update, important file modified' '
82
touch subdir/e &&
83
git add subdir/e &&
84
85
- test_must_fail git merge E^0
85
+ test_must_fail git merge E^0 &&
86
+ test_path_is_missing .git/MERGE_HEAD
87
'
88
89
test_expect_success 'resolve, trivial' '
@@ -91,7 +92,8 @@ test_expect_success 'resolve, trivial' '
92
93
touch random_file && git add random_file &&
94
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
97
'
98
99
test_expect_success 'resolve, non-trivial' '
@@ -100,7 +102,8 @@ test_expect_success 'resolve, non-trivial' '
102
103
touch random_file && git add random_file &&
104
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
107
'
108
109
test_expect_success 'recursive' '
@@ -109,16 +112,18 @@ test_expect_success 'recursive' '
112
113
touch random_file && git add random_file &&
114
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
117
'
118
115
-test_expect_success 'recursive, when merge branch matches merge base' '
119
+test_expect_failure 'recursive, when merge branch matches merge base' '
120
git reset --hard &&
121
git checkout B^0 &&
122
123
touch random_file && git add random_file &&
124
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
127
'
128
129
test_expect_success 'octopus, unrelated file touched' '
@@ -127,7 +132,8 @@ test_expect_success 'octopus, unrelated file touched' '
132
133
touch random_file && git add random_file &&
134
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
137
'
138
139
test_expect_success 'octopus, related file removed' '
@@ -136,7 +142,8 @@ test_expect_success 'octopus, related file removed' '
142
143
git rm b &&
144
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
147
'
148
149
test_expect_success 'octopus, related file modified' '
@@ -145,7 +152,8 @@ test_expect_success 'octopus, related file modified' '
152
153
echo 12 >>a && git add a &&
154
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
157
'
158
159
test_expect_success 'ours' '
@@ -154,7 +162,8 @@ test_expect_success 'ours' '
162
163
touch random_file && git add random_file &&
164
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
167
'
168
169
test_expect_success 'subtree' '
@@ -163,7 +172,8 @@ test_expect_success 'subtree' '
172
173
touch random_file && git add random_file &&
174
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
177
'
178
179
test_done