@@ -71,7 +71,9 @@ test_expect_success 'ff update' '
71
71
git merge E^0 &&
72
72
73
73
test_must_fail git rev-parse HEAD:random_file &&
74
- test "$(git diff --name-only --cached E)" = "random_file"
74
+ test "$(git diff --name-only --cached E)" = "random_file" &&
75
+ test_path_is_file random_file &&
76
+ git rev-parse --verify :random_file
75
77
'
76
78
77
79
test_expect_success ' ff update, important file modified' '
@@ -83,6 +85,8 @@ test_expect_success 'ff update, important file modified' '
83
85
git add subdir/e &&
84
86
85
87
test_must_fail git merge E^0 &&
88
+ test_path_is_file subdir/e &&
89
+ git rev-parse --verify :subdir/e &&
86
90
test_path_is_missing .git/MERGE_HEAD
87
91
'
88
92
@@ -93,6 +97,8 @@ test_expect_success 'resolve, trivial' '
93
97
touch random_file && git add random_file &&
94
98
95
99
test_must_fail git merge -s resolve C^0 &&
100
+ test_path_is_file random_file &&
101
+ git rev-parse --verify :random_file &&
96
102
test_path_is_missing .git/MERGE_HEAD
97
103
'
98
104
@@ -103,6 +109,8 @@ test_expect_success 'resolve, non-trivial' '
103
109
touch random_file && git add random_file &&
104
110
105
111
test_must_fail git merge -s resolve D^0 &&
112
+ test_path_is_file random_file &&
113
+ git rev-parse --verify :random_file &&
106
114
test_path_is_missing .git/MERGE_HEAD
107
115
'
108
116
@@ -113,6 +121,8 @@ test_expect_success 'recursive' '
113
121
touch random_file && git add random_file &&
114
122
115
123
test_must_fail git merge -s recursive C^0 &&
124
+ test_path_is_file random_file &&
125
+ git rev-parse --verify :random_file &&
116
126
test_path_is_missing .git/MERGE_HEAD
117
127
'
118
128
@@ -145,9 +155,12 @@ test_expect_success 'recursive, when file has staged changes not matching HEAD n
145
155
mkdir subdir &&
146
156
test_seq 1 10 >subdir/a &&
147
157
git add subdir/a &&
158
+ git rev-parse --verify :subdir/a >expect &&
148
159
149
160
# We have staged changes; merge should error out
150
161
test_must_fail git merge -s recursive E^0 2>err &&
162
+ git rev-parse --verify :subdir/a >actual &&
163
+ test_cmp expect actual &&
151
164
test_i18ngrep "changes to the following files would be overwritten" err
152
165
'
153
166
@@ -158,9 +171,12 @@ test_expect_success 'recursive, when file has staged changes matching what a mer
158
171
mkdir subdir &&
159
172
test_seq 1 11 >subdir/a &&
160
173
git add subdir/a &&
174
+ git rev-parse --verify :subdir/a >expect &&
161
175
162
176
# We have staged changes; merge should error out
163
177
test_must_fail git merge -s recursive E^0 2>err &&
178
+ git rev-parse --verify :subdir/a >actual &&
179
+ test_cmp expect actual &&
164
180
test_i18ngrep "changes to the following files would be overwritten" err
165
181
'
166
182
@@ -171,7 +187,9 @@ test_expect_success 'octopus, unrelated file touched' '
171
187
touch random_file && git add random_file &&
172
188
173
189
test_must_fail git merge C^0 D^0 &&
174
- test_path_is_missing .git/MERGE_HEAD
190
+ test_path_is_missing .git/MERGE_HEAD &&
191
+ git rev-parse --verify :random_file &&
192
+ test_path_exists random_file
175
193
'
176
194
177
195
test_expect_success ' octopus, related file removed' '
@@ -181,6 +199,8 @@ test_expect_success 'octopus, related file removed' '
181
199
git rm b &&
182
200
183
201
test_must_fail git merge C^0 D^0 &&
202
+ test_path_is_missing b &&
203
+ test_must_fail git rev-parse --verify :b &&
184
204
test_path_is_missing .git/MERGE_HEAD
185
205
'
186
206
@@ -189,8 +209,12 @@ test_expect_success 'octopus, related file modified' '
189
209
git checkout B^0 &&
190
210
191
211
echo 12 >>a && git add a &&
212
+ git rev-parse --verify :a >expect &&
192
213
193
214
test_must_fail git merge C^0 D^0 &&
215
+ test_path_is_file a &&
216
+ git rev-parse --verify :a >actual &&
217
+ test_cmp expect actual &&
194
218
test_path_is_missing .git/MERGE_HEAD
195
219
'
196
220
@@ -201,6 +225,8 @@ test_expect_success 'ours' '
201
225
touch random_file && git add random_file &&
202
226
203
227
test_must_fail git merge -s ours C^0 &&
228
+ test_path_is_file random_file &&
229
+ git rev-parse --verify :random_file &&
204
230
test_path_is_missing .git/MERGE_HEAD
205
231
'
206
232
@@ -211,6 +237,8 @@ test_expect_success 'subtree' '
211
237
touch random_file && git add random_file &&
212
238
213
239
test_must_fail git merge -s subtree E^0 &&
240
+ test_path_is_file random_file &&
241
+ git rev-parse --verify :random_file &&
214
242
test_path_is_missing .git/MERGE_HEAD
215
243
'
216
244
0 commit comments