merge tests: expect improved directory/file conflict handling in ort

merge-recursive.c is built on the idea of running unpack_trees() and then "doing minor touch-ups" to get the result. Unfortunately, unpack_trees() was run in an update-as-it-goes mode, leading merge-recursive.c to follow suit and end up with an immediate evaluation and fix-it-up-as-you-go design. Some things like directory/file conflicts are not well representable in the index data structure, and required special extra code to handle. But then when it was discovered that rename/delete conflicts could also be involved in directory/file conflicts, the special directory/file conflict handling code had to be copied to the rename/delete codepath. ...and then it had to be copied for modify/delete, and for rename/rename(1to2) conflicts, ...and yet it still missed some. Further, when it was discovered that there were also file/submodule conflicts and submodule/directory conflicts, we needed to copy the special submodule handling code to all the special cases throughout the codebase. And then it was discovered that our handling of directory/file conflicts was suboptimal because it would create untracked files to store the contents of the conflicting file, which would not be cleaned up if someone were to run a 'git merge --abort' or 'git rebase --abort'. It was also difficult or scary to try to add or remove the index entries corresponding to these files given the directory/file conflict in the index. But changing merge-recursive.c to handle these correctly was a royal pain because there were so many sites in the code with similar but not identical code for handling directory/file/submodule conflicts that would all need to be updated. I have worked hard to push all directory/file/submodule conflict handling in merge-ort through a single codepath, and avoid creating untracked files for storing tracked content (it does record things at alternate paths, but makes sure they have higher-order stages in the index). Since updating merge-recursive is too much work and we don't want to destabilize it, instead update the testsuite to have different expectations for relevant directory/file/submodule conflict tests. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Oct 26, 2020 at 17:01 UTC ef527787089ce9a5c137ffde24701dfb7fda841c
6 files changed +314 -108
t/t6400-merge-df.sh
+12 -2
@@ -81,7 +81,12 @@ test_expect_success 'modify/delete + directory/file conflict' '
81
82 test 5 -eq $(git ls-files -s | wc -l) &&
83 test 4 -eq $(git ls-files -u | wc -l) &&
84 - test 1 -eq $(git ls-files -o | wc -l) &&
84 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
85 + then
86 + test 0 -eq $(git ls-files -o | wc -l)
87 + else
88 + test 1 -eq $(git ls-files -o | wc -l)
89 + fi &&
90
91 test_path_is_file letters/file &&
92 test_path_is_file letters.txt &&
@@ -97,7 +102,12 @@ test_expect_success 'modify/delete + directory/file conflict; other way' '
102
103 test 5 -eq $(git ls-files -s | wc -l) &&
104 test 4 -eq $(git ls-files -u | wc -l) &&
100 - test 1 -eq $(git ls-files -o | wc -l) &&
105 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
106 + then
107 + test 0 -eq $(git ls-files -o | wc -l)
108 + else
109 + test 1 -eq $(git ls-files -o | wc -l)
110 + fi &&
111
112 test_path_is_file letters/file &&
113 test_path_is_file letters.txt &&
t/t6402-merge-rename.sh
+81 -27
@@ -397,7 +397,12 @@ test_expect_success 'Rename+D/F conflict; renamed file cannot merge and dir in t
397 test_must_fail git merge --strategy=recursive dir-in-way &&
398
399 test 5 -eq "$(git ls-files -u | wc -l)" &&
400 - test 3 -eq "$(git ls-files -u dir | grep -v file-in-the-way | wc -l)" &&
400 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
401 + then
402 + test 3 -eq "$(git ls-files -u dir~HEAD | wc -l)"
403 + else
404 + test 3 -eq "$(git ls-files -u dir | grep -v file-in-the-way | wc -l)"
405 + fi &&
406 test 2 -eq "$(git ls-files -u dir/file-in-the-way | wc -l)" &&
407
408 test_must_fail git diff --quiet &&
@@ -415,7 +420,12 @@ test_expect_success 'Same as previous, but merged other way' '
420 test_must_fail git merge --strategy=recursive renamed-file-has-conflicts &&
421
422 test 5 -eq "$(git ls-files -u | wc -l)" &&
418 - test 3 -eq "$(git ls-files -u dir | grep -v file-in-the-way | wc -l)" &&
423 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
424 + then
425 + test 3 -eq "$(git ls-files -u dir~renamed-file-has-conflicts | wc -l)"
426 + else
427 + test 3 -eq "$(git ls-files -u dir | grep -v file-in-the-way | wc -l)"
428 + fi &&
429 test 2 -eq "$(git ls-files -u dir/file-in-the-way | wc -l)" &&
430
431 test_must_fail git diff --quiet &&
@@ -471,7 +481,12 @@ test_expect_success 'both rename source and destination involved in D/F conflict
481 git checkout -q rename-dest^0 &&
482 test_must_fail git merge --strategy=recursive source-conflict &&
483
474 - test 1 -eq "$(git ls-files -u | wc -l)" &&
484 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
485 + then
486 + test 2 -eq "$(git ls-files -u | wc -l)"
487 + else
488 + test 1 -eq "$(git ls-files -u | wc -l)"
489 + fi &&
490
491 test_must_fail git diff --quiet &&
492
@@ -505,34 +520,63 @@ test_expect_success 'setup pair rename to parent of other (D/F conflicts)' '
520 git commit -m "Rename one/file -> two"
521 '
522
508 -test_expect_success 'pair rename to parent of other (D/F conflicts) w/ untracked dir' '
509 - git checkout -q rename-one^0 &&
510 - mkdir one &&
511 - test_must_fail git merge --strategy=recursive rename-two &&
523 +if test "$GIT_TEST_MERGE_ALGORITHM" = ort
524 +then
525 + test_expect_success 'pair rename to parent of other (D/F conflicts) w/ untracked dir' '
526 + git checkout -q rename-one^0 &&
527 + mkdir one &&
528 + test_must_fail git merge --strategy=recursive rename-two &&
529
513 - test 2 -eq "$(git ls-files -u | wc -l)" &&
514 - test 1 -eq "$(git ls-files -u one | wc -l)" &&
515 - test 1 -eq "$(git ls-files -u two | wc -l)" &&
530 + test 4 -eq "$(git ls-files -u | wc -l)" &&
531 + test 2 -eq "$(git ls-files -u one | wc -l)" &&
532 + test 2 -eq "$(git ls-files -u two | wc -l)" &&
533
517 - test_must_fail git diff --quiet &&
534 + test_must_fail git diff --quiet &&
535
519 - test 4 -eq $(find . | grep -v .git | wc -l) &&
536 + test 3 -eq $(find . | grep -v .git | wc -l) &&
537
521 - test_path_is_dir one &&
522 - test_path_is_file one~rename-two &&
523 - test_path_is_file two &&
524 - test "other" = $(cat one~rename-two) &&
525 - test "stuff" = $(cat two)
526 -'
538 + test_path_is_file one &&
539 + test_path_is_file two &&
540 + test "other" = $(cat one) &&
541 + test "stuff" = $(cat two)
542 + '
543 +else
544 + test_expect_success 'pair rename to parent of other (D/F conflicts) w/ untracked dir' '
545 + git checkout -q rename-one^0 &&
546 + mkdir one &&
547 + test_must_fail git merge --strategy=recursive rename-two &&
548 +
549 + test 2 -eq "$(git ls-files -u | wc -l)" &&
550 + test 1 -eq "$(git ls-files -u one | wc -l)" &&
551 + test 1 -eq "$(git ls-files -u two | wc -l)" &&
552 +
553 + test_must_fail git diff --quiet &&
554 +
555 + test 4 -eq $(find . | grep -v .git | wc -l) &&
556 +
557 + test_path_is_dir one &&
558 + test_path_is_file one~rename-two &&
559 + test_path_is_file two &&
560 + test "other" = $(cat one~rename-two) &&
561 + test "stuff" = $(cat two)
562 + '
563 +fi
564
565 test_expect_success 'pair rename to parent of other (D/F conflicts) w/ clean start' '
566 git reset --hard &&
567 git clean -fdqx &&
568 test_must_fail git merge --strategy=recursive rename-two &&
569
533 - test 2 -eq "$(git ls-files -u | wc -l)" &&
534 - test 1 -eq "$(git ls-files -u one | wc -l)" &&
535 - test 1 -eq "$(git ls-files -u two | wc -l)" &&
570 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
571 + then
572 + test 4 -eq "$(git ls-files -u | wc -l)" &&
573 + test 2 -eq "$(git ls-files -u one | wc -l)" &&
574 + test 2 -eq "$(git ls-files -u two | wc -l)"
575 + else
576 + test 2 -eq "$(git ls-files -u | wc -l)" &&
577 + test 1 -eq "$(git ls-files -u one | wc -l)" &&
578 + test 1 -eq "$(git ls-files -u two | wc -l)"
579 + fi &&
580
581 test_must_fail git diff --quiet &&
582
@@ -572,12 +616,22 @@ test_expect_success 'check handling of differently renamed file with D/F conflic
616 git checkout -q first-rename^0 &&
617 test_must_fail git merge --strategy=recursive second-rename &&
618
575 - test 5 -eq "$(git ls-files -s | wc -l)" &&
576 - test 3 -eq "$(git ls-files -u | wc -l)" &&
577 - test 1 -eq "$(git ls-files -u one | wc -l)" &&
578 - test 1 -eq "$(git ls-files -u two | wc -l)" &&
579 - test 1 -eq "$(git ls-files -u original | wc -l)" &&
580 - test 2 -eq "$(git ls-files -o | wc -l)" &&
619 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
620 + then
621 + test 5 -eq "$(git ls-files -s | wc -l)" &&
622 + test 3 -eq "$(git ls-files -u | wc -l)" &&
623 + test 1 -eq "$(git ls-files -u one~HEAD | wc -l)" &&
624 + test 1 -eq "$(git ls-files -u two~second-rename | wc -l)" &&
625 + test 1 -eq "$(git ls-files -u original | wc -l)" &&
626 + test 0 -eq "$(git ls-files -o | wc -l)"
627 + else
628 + test 5 -eq "$(git ls-files -s | wc -l)" &&
629 + test 3 -eq "$(git ls-files -u | wc -l)" &&
630 + test 1 -eq "$(git ls-files -u one | wc -l)" &&
631 + test 1 -eq "$(git ls-files -u two | wc -l)" &&
632 + test 1 -eq "$(git ls-files -u original | wc -l)" &&
633 + test 2 -eq "$(git ls-files -o | wc -l)"
634 + fi &&
635
636 test_path_is_file one/file &&
637 test_path_is_file two/file &&
t/t6416-recursive-corner-cases.sh
+132 -53
@@ -538,9 +538,15 @@ test_expect_success 'setup differently handled merges of directory/file conflict
538
539 git checkout B^0 &&
540 test_must_fail git merge C^0 &&
541 - git clean -fd &&
542 - git rm -rf a/ &&
543 - git rm a &&
541 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
542 + then
543 + git rm -rf a/ &&
544 + git rm a~HEAD
545 + else
546 + git clean -fd &&
547 + git rm -rf a/ &&
548 + git rm a
549 + fi &&
550 git cat-file -p B:a >a2 &&
551 git add a2 &&
552 git commit -m D2 &&
@@ -559,7 +565,12 @@ test_expect_success 'setup differently handled merges of directory/file conflict
565
566 git checkout C^0 &&
567 test_must_fail git merge B^0 &&
562 - git clean -fd &&
568 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
569 + then
570 + git rm a~B^0
571 + else
572 + git clean -fd
573 + fi &&
574 git rm -rf a/ &&
575 test_write_lines 1 2 3 4 5 6 7 8 >a &&
576 git add a &&
@@ -568,9 +579,15 @@ test_expect_success 'setup differently handled merges of directory/file conflict
579
580 git checkout C^0 &&
581 test_must_fail git merge B^0 &&
571 - git clean -fd &&
572 - git rm -rf a/ &&
573 - git rm a &&
582 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
583 + then
584 + git rm -rf a/ &&
585 + git rm a~B^0
586 + else
587 + git clean -fd &&
588 + git rm -rf a/ &&
589 + git rm a
590 + fi &&
591 test_write_lines 1 2 3 4 5 6 7 8 >a2 &&
592 git add a2 &&
593 git commit -m E4 &&
@@ -588,18 +605,34 @@ test_expect_success 'merge of D1 & E1 fails but has appropriate contents' '
605
606 test_must_fail git merge -s recursive E1^0 &&
607
591 - git ls-files -s >out &&
592 - test_line_count = 2 out &&
593 - git ls-files -u >out &&
594 - test_line_count = 1 out &&
595 - git ls-files -o >out &&
596 - test_line_count = 1 out &&
597 -
598 - git rev-parse >expect \
599 - A:ignore-me B:a &&
600 - git rev-parse >actual \
601 - :0:ignore-me :2:a &&
602 - test_cmp expect actual
608 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
609 + then
610 + git ls-files -s >out &&
611 + test_line_count = 3 out &&
612 + git ls-files -u >out &&
613 + test_line_count = 2 out &&
614 + git ls-files -o >out &&
615 + test_line_count = 1 out &&
616 +
617 + git rev-parse >expect \
618 + A:ignore-me B:a D1:a &&
619 + git rev-parse >actual \
620 + :0:ignore-me :1:a :2:a &&
621 + test_cmp expect actual
622 + else
623 + git ls-files -s >out &&
624 + test_line_count = 2 out &&
625 + git ls-files -u >out &&
626 + test_line_count = 1 out &&
627 + git ls-files -o >out &&
628 + test_line_count = 1 out &&
629 +
630 + git rev-parse >expect \
631 + A:ignore-me B:a &&
632 + git rev-parse >actual \
633 + :0:ignore-me :2:a &&
634 + test_cmp expect actual
635 + fi
636 )
637 '
638
@@ -613,18 +646,34 @@ test_expect_success 'merge of E1 & D1 fails but has appropriate contents' '
646
647 test_must_fail git merge -s recursive D1^0 &&
648
616 - git ls-files -s >out &&
617 - test_line_count = 2 out &&
618 - git ls-files -u >out &&
619 - test_line_count = 1 out &&
620 - git ls-files -o >out &&
621 - test_line_count = 1 out &&
622 -
623 - git rev-parse >expect \
624 - A:ignore-me B:a &&
625 - git rev-parse >actual \
626 - :0:ignore-me :3:a &&
627 - test_cmp expect actual
649 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
650 + then
651 + git ls-files -s >out &&
652 + test_line_count = 3 out &&
653 + git ls-files -u >out &&
654 + test_line_count = 2 out &&
655 + git ls-files -o >out &&
656 + test_line_count = 1 out &&
657 +
658 + git rev-parse >expect \
659 + A:ignore-me B:a D1:a &&
660 + git rev-parse >actual \
661 + :0:ignore-me :1:a :3:a &&
662 + test_cmp expect actual
663 + else
664 + git ls-files -s >out &&
665 + test_line_count = 2 out &&
666 + git ls-files -u >out &&
667 + test_line_count = 1 out &&
668 + git ls-files -o >out &&
669 + test_line_count = 1 out &&
670 +
671 + git rev-parse >expect \
672 + A:ignore-me B:a &&
673 + git rev-parse >actual \
674 + :0:ignore-me :3:a &&
675 + test_cmp expect actual
676 + fi
677 )
678 '
679
@@ -638,17 +687,32 @@ test_expect_success 'merge of D1 & E2 fails but has appropriate contents' '
687
688 test_must_fail git merge -s recursive E2^0 &&
689
641 - git ls-files -s >out &&
642 - test_line_count = 4 out &&
643 - git ls-files -u >out &&
644 - test_line_count = 3 out &&
645 - git ls-files -o >out &&
646 - test_line_count = 2 out &&
647 -
648 - git rev-parse >expect \
649 - B:a E2:a/file C:a/file A:ignore-me &&
650 - git rev-parse >actual \
651 - :2:a :3:a/file :1:a/file :0:ignore-me &&
690 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
691 + then
692 + git ls-files -s >out &&
693 + test_line_count = 5 out &&
694 + git ls-files -u >out &&
695 + test_line_count = 4 out &&
696 + git ls-files -o >out &&
697 + test_line_count = 1 out &&
698 +
699 + git rev-parse >expect \
700 + B:a D1:a E2:a/file C:a/file A:ignore-me &&
701 + git rev-parse >actual \
702 + :1:a~HEAD :2:a~HEAD :3:a/file :1:a/file :0:ignore-me
703 + else
704 + git ls-files -s >out &&
705 + test_line_count = 4 out &&
706 + git ls-files -u >out &&
707 + test_line_count = 3 out &&
708 + git ls-files -o >out &&
709 + test_line_count = 2 out &&
710 +
711 + git rev-parse >expect \
712 + B:a E2:a/file C:a/file A:ignore-me &&
713 + git rev-parse >actual \
714 + :2:a :3:a/file :1:a/file :0:ignore-me
715 + fi &&
716 test_cmp expect actual &&
717
718 test_path_is_file a~HEAD
@@ -665,17 +729,32 @@ test_expect_success 'merge of E2 & D1 fails but has appropriate contents' '
729
730 test_must_fail git merge -s recursive D1^0 &&
731
668 - git ls-files -s >out &&
669 - test_line_count = 4 out &&
670 - git ls-files -u >out &&
671 - test_line_count = 3 out &&
672 - git ls-files -o >out &&
673 - test_line_count = 2 out &&
674 -
675 - git rev-parse >expect \
676 - B:a E2:a/file C:a/file A:ignore-me &&
677 - git rev-parse >actual \
678 - :3:a :2:a/file :1:a/file :0:ignore-me &&
732 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
733 + then
734 + git ls-files -s >out &&
735 + test_line_count = 5 out &&
736 + git ls-files -u >out &&
737 + test_line_count = 4 out &&
738 + git ls-files -o >out &&
739 + test_line_count = 1 out &&
740 +
741 + git rev-parse >expect \
742 + B:a D1:a E2:a/file C:a/file A:ignore-me &&
743 + git rev-parse >actual \
744 + :1:a~D1^0 :3:a~D1^0 :2:a/file :1:a/file :0:ignore-me
745 + else
746 + git ls-files -s >out &&
747 + test_line_count = 4 out &&
748 + git ls-files -u >out &&
749 + test_line_count = 3 out &&
750 + git ls-files -o >out &&
751 + test_line_count = 2 out &&
752 +
753 + git rev-parse >expect \
754 + B:a E2:a/file C:a/file A:ignore-me &&
755 + git rev-parse >actual \
756 + :3:a :2:a/file :1:a/file :0:ignore-me
757 + fi &&
758 test_cmp expect actual &&
759
760 test_path_is_file a~D1^0
t/t6422-merge-rename-corner-cases.sh
+22 -8
@@ -313,15 +313,18 @@ test_expect_success 'rename/directory conflict + clean content merge' '
313 git ls-files -u >out &&
314 test_line_count = 1 out &&
315 git ls-files -o >out &&
316 - test_line_count = 2 out &&
316 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
317 + then
318 + test_line_count = 1 out
319 + else
320 + test_line_count = 2 out
321 + fi &&
322
323 echo 0 >expect &&
324 git cat-file -p base:file >>expect &&
325 echo 7 >>expect &&
326 test_cmp expect newfile~HEAD &&
327
323 - test $(git rev-parse :2:newfile) = $(git hash-object expect) &&
324 -
328 test_path_is_file newfile/realfile &&
329 test_path_is_file newfile~HEAD
330 )
@@ -344,7 +347,12 @@ test_expect_success 'rename/directory conflict + content merge conflict' '
347 git ls-files -u >out &&
348 test_line_count = 3 out &&
349 git ls-files -o >out &&
347 - test_line_count = 2 out &&
350 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
351 + then
352 + test_line_count = 1 out
353 + else
354 + test_line_count = 2 out
355 + fi &&
356
357 git cat-file -p left-conflict:newfile >left &&
358 git cat-file -p base:file >base &&
@@ -356,10 +364,16 @@ test_expect_success 'rename/directory conflict + content merge conflict' '
364 left base right &&
365 test_cmp left newfile~HEAD &&
366
359 - git rev-parse >expect \
360 - base:file left-conflict:newfile right:file &&
361 - git rev-parse >actual \
362 - :1:newfile :2:newfile :3:newfile &&
367 + git rev-parse >expect \
368 + base:file left-conflict:newfile right:file &&
369 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
370 + then
371 + git rev-parse >actual \
372 + :1:newfile~HEAD :2:newfile~HEAD :3:newfile~HEAD
373 + else
374 + git rev-parse >actual \
375 + :1:newfile :2:newfile :3:newfile
376 + fi &&
377 test_cmp expect actual &&
378
379 test_path_is_file newfile/realfile &&
t/t6423-merge-rename-directories.sh
+38 -15
@@ -1177,10 +1177,18 @@ test_expect_success '5d: Directory/file/file conflict due to directory rename' '
1177 git ls-files -u >out &&
1178 test_line_count = 1 out &&
1179 git ls-files -o >out &&
1180 - test_line_count = 2 out &&
1181 -
1182 - git rev-parse >actual \
1183 - :0:y/b :0:y/c :0:z/d :0:y/f :2:y/d :0:y/d/e &&
1180 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
1181 + then
1182 + test_line_count = 1 out &&
1183 +
1184 + git rev-parse >actual \
1185 + :0:y/b :0:y/c :0:z/d :0:y/f :2:y/d~HEAD :0:y/d/e
1186 + else
1187 + test_line_count = 2 out &&
1188 +
1189 + git rev-parse >actual \
1190 + :0:y/b :0:y/c :0:z/d :0:y/f :2:y/d :0:y/d/e
1191 + fi &&
1192 git rev-parse >expect \
1193 O:z/b O:z/c B:z/d B:z/f A:y/d B:y/d/e &&
1194 test_cmp expect actual &&
@@ -2017,17 +2025,32 @@ test_expect_success '7e: transitive rename in rename/delete AND dirs in the way'
2025 test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
2026 test_i18ngrep "CONFLICT (rename/delete).*x/d.*y/d" out &&
2027
2020 - git ls-files -s >out &&
2021 - test_line_count = 5 out &&
2022 - git ls-files -u >out &&
2023 - test_line_count = 1 out &&
2024 - git ls-files -o >out &&
2025 - test_line_count = 2 out &&
2026 -
2027 - git rev-parse >actual \
2028 - :0:x/d/f :0:y/d/g :0:y/b :0:y/c :3:y/d &&
2029 - git rev-parse >expect \
2030 - A:x/d/f A:y/d/g O:z/b O:z/c O:x/d &&
2028 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
2029 + then
2030 + git ls-files -s >out &&
2031 + test_line_count = 6 out &&
2032 + git ls-files -u >out &&
2033 + test_line_count = 2 out &&
2034 + git ls-files -o >out &&
2035 + test_line_count = 1 out &&
2036 +
2037 + git rev-parse >actual \
2038 + :0:x/d/f :0:y/d/g :0:y/b :0:y/c :1:y/d~B^0 :3:y/d~B^0 &&
2039 + git rev-parse >expect \
2040 + A:x/d/f A:y/d/g O:z/b O:z/c O:x/d O:x/d
2041 + else
2042 + git ls-files -s >out &&
2043 + test_line_count = 5 out &&
2044 + git ls-files -u >out &&
2045 + test_line_count = 1 out &&
2046 + git ls-files -o >out &&
2047 + test_line_count = 2 out &&
2048 +
2049 + git rev-parse >actual \
2050 + :0:x/d/f :0:y/d/g :0:y/b :0:y/c :3:y/d &&
2051 + git rev-parse >expect \
2052 + A:x/d/f A:y/d/g O:z/b O:z/c O:x/d
2053 + fi &&
2054 test_cmp expect actual &&
2055
2056 git hash-object y/d~B^0 >actual &&
t/t7610-mergetool.sh
+29 -3
@@ -532,7 +532,14 @@ test_expect_success 'file vs modified submodule' '
532 yes "" | git mergetool file1 file2 spaced\ name subdir/file3 &&
533 yes "" | git mergetool both &&
534 yes "d" | git mergetool file11 file12 &&
535 - yes "l" | git mergetool submod &&
535 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
536 + then
537 + yes "c" | git mergetool submod~HEAD &&
538 + git rm submod &&
539 + git mv submod~HEAD submod
540 + else
541 + yes "l" | git mergetool submod
542 + fi &&
543 git submodule update -N &&
544 echo "not a submodule" >expect &&
545 test_cmp expect submod &&
@@ -549,7 +556,15 @@ test_expect_success 'file vs modified submodule' '
556 yes "" | git mergetool file1 file2 spaced\ name subdir/file3 &&
557 yes "" | git mergetool both &&
558 yes "d" | git mergetool file11 file12 &&
552 - yes "r" | git mergetool submod &&
559 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
560 + then
561 + mv submod submod.orig &&
562 + git rm --cached submod &&
563 + yes "c" | git mergetool submod~test19 &&
564 + git mv submod~test19 submod
565 + else
566 + yes "r" | git mergetool submod
567 + fi &&
568 test -d submod.orig &&
569 git submodule update -N &&
570 echo "not a submodule" >expect &&
@@ -567,6 +582,10 @@ test_expect_success 'file vs modified submodule' '
582 yes "" | git mergetool both &&
583 yes "d" | git mergetool file11 file12 &&
584 yes "l" | git mergetool submod &&
585 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
586 + then
587 + yes "d" | git mergetool submod~test19
588 + fi &&
589 echo "master submodule" >expect &&
590 test_cmp expect submod/bar &&
591 git submodule update -N &&
@@ -664,7 +683,14 @@ test_expect_success 'directory vs modified submodule' '
683 test_must_fail git merge master &&
684 test -n "$(git ls-files -u)" &&
685 test ! -e submod.orig &&
667 - yes "r" | git mergetool submod &&
686 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
687 + then
688 + yes "r" | git mergetool submod~master &&
689 + git mv submod submod.orig &&
690 + git mv submod~master submod
691 + else
692 + yes "r" | git mergetool submod
693 + fi &&
694 test -d submod.orig &&
695 echo "not a submodule" >expect &&
696 test_cmp expect submod.orig/file16 &&