t6036: Add differently resolved modify/delete conflict in criss-cross test
Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren committed
Aug 11, 2011 at 23:19 UTC
fe7e9c23e4ef183eaff5256a7ce681296f3a92f6
1 file changed
+83
t/t6036-recursive-corner-cases.sh
+83
@@ -231,4 +231,87 @@ test_expect_success 'git detects differently handled merges conflict' '
231
test $(git rev-parse :1:new_a) = $(git hash-object merged)
232
'
233
234
+#
235
+# criss-cross + modify/delete:
236
+#
237
+# B D
238
+# o---o
239
+# / \ / \
240
+# A o X ? F
241
+# \ / \ /
242
+# o---o
243
+# C E
244
+#
245
+# Commit A: file with contents 'A\n'
246
+# Commit B: file with contents 'B\n'
247
+# Commit C: file not present
248
+# Commit D: file with contents 'B\n'
249
+# Commit E: file not present
250
+#
251
+# Merging commits D & E should result in modify/delete conflict.
252
+
253
+test_expect_success 'setup criss-cross + modify/delete resolved differently' '
254
+ git rm -rf . &&
255
+ git clean -fdqx &&
256
+ rm -rf .git &&
257
+ git init &&
258
+
259
+ echo A >file &&
260
+ git add file &&
261
+ test_tick &&
262
+ git commit -m A &&
263
+
264
+ git branch B &&
265
+ git checkout -b C &&
266
+ git rm file &&
267
+ test_tick &&
268
+ git commit -m C &&
269
+
270
+ git checkout B &&
271
+ echo B >file &&
272
+ git add file &&
273
+ test_tick &&
274
+ git commit -m B &&
275
+
276
+ git checkout B^0 &&
277
+ test_must_fail git merge C &&
278
+ echo B >file &&
279
+ git add file &&
280
+ test_tick &&
281
+ git commit -m D &&
282
+ git tag D &&
283
+
284
+ git checkout C^0 &&
285
+ test_must_fail git merge B &&
286
+ git rm file &&
287
+ test_tick &&
288
+ git commit -m E &&
289
+ git tag E
290
+'
291
+
292
+test_expect_failure 'git detects conflict merging criss-cross+modify/delete' '
293
+ git checkout D^0 &&
294
+
295
+ test_must_fail git merge -s recursive E^0 &&
296
+
297
+ test 2 -eq $(git ls-files -s | wc -l) &&
298
+ test 2 -eq $(git ls-files -u | wc -l) &&
299
+
300
+ test $(git rev-parse :1:file) = $(git rev-parse master:file) &&
301
+ test $(git rev-parse :2:file) = $(git rev-parse B:file)
302
+'
303
+
304
+test_expect_failure 'git detects conflict merging criss-cross+modify/delete, reverse direction' '
305
+ git reset --hard &&
306
+ git checkout E^0 &&
307
+
308
+ test_must_fail git merge -s recursive D^0 &&
309
+
310
+ test 2 -eq $(git ls-files -s | wc -l) &&
311
+ test 2 -eq $(git ls-files -u | wc -l) &&
312
+
313
+ test $(git rev-parse :1:file) = $(git rev-parse master:file) &&
314
+ test $(git rev-parse :3:file) = $(git rev-parse B:file)
315
+'
316
+
317
test_done