415
test_cmp expected dir~HEAD
416
'
417
418
+test_expect_failure 'Same as previous, but merged other way' '
419
+ git reset --hard &&
420
+ rm -rf dir~* &&
421
+ git checkout -q dir-in-way^0 &&
422
+ test_must_fail git merge --strategy=recursive renamed-file-has-no-conflicts >output 2>errors &&
423
+
424
+ ! grep "error: refusing to lose untracked file at" errors &&
425
+ grep "CONFLICT (delete/modify): dir/file-in-the-way" output &&
426
+ grep "Auto-merging dir" output &&
427
+ grep "Adding as dir~renamed-file-has-no-conflicts instead" output &&
428
+
429
+ test 2 = "$(git ls-files -u | wc -l)" &&
430
+ test 2 = "$(git ls-files -u dir/file-in-the-way | wc -l)" &&
431
+
432
+ test_must_fail git diff --quiet &&
433
+ test_must_fail git diff --cached --quiet &&
434
+
435
+ test -f dir/file-in-the-way &&
436
+ test -f dir~renamed-file-has-no-conflicts &&
437
+ test_cmp expected dir~renamed-file-has-no-conflicts
438
+'
439
+
440
cat >expected <<\EOF &&
441
1
442
2
491
test_cmp expected dir~HEAD
492
'
493
494
+cat >expected <<\EOF &&
495
+1
496
+2
497
+3
498
+4
499
+5
500
+6
501
+7
502
+8
503
+9
504
+10
505
+<<<<<<< HEAD
506
+11
507
+=======
508
+12
509
+>>>>>>> renamed-file-has-conflicts
510
+EOF
511
+
512
+test_expect_failure 'Same as previous, but merged other way' '
513
+ git reset --hard &&
514
+ rm -rf dir~* &&
515
+ git checkout -q dir-in-way^0 &&
516
+ test_must_fail git merge --strategy=recursive renamed-file-has-conflicts &&
517
+
518
+ test 5 = "$(git ls-files -u | wc -l)" &&
519
+ test 3 = "$(git ls-files -u dir | grep -v file-in-the-way | wc -l)" &&
520
+ test 2 = "$(git ls-files -u dir/file-in-the-way | wc -l)" &&
521
+
522
+ test_must_fail git diff --quiet &&
523
+ test_must_fail git diff --cached --quiet &&
524
+
525
+ test -f dir/file-in-the-way &&
526
+ test -f dir~renamed-file-has-conflicts &&
527
+ test_cmp expected dir~renamed-file-has-conflicts
528
+'
529
+
530
test_done