t6036: criss-cross + rename/rename(1to2)/add-dest + simple modify

This is another testcase trying to exercise the virtual merge base creation in the rename/rename(1to2) code. A testcase is added that we should be able to merge cleanly, but which requires a virtual merge base to be created that correctly handles rename/add-dest conflicts within the rename/rename(1to2) testcase handling. 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:20 UTC b630b8147055a6fd56edfdf3ba85e9dea27dd397
1 file changed +69
t/t6036-recursive-corner-cases.sh
+69
@@ -704,4 +704,73 @@ test_expect_failure 'detect rename/rename/add-source for virtual merge-base' '
704 test "$(cat a)" = "$(printf "1\n2\n3\n4\n5\n6\n7\n8\n")"
705 '
706
707 +#
708 +# criss-cross with rename/rename(1to2)/add-dest + simple modify:
709 +#
710 +# B D
711 +# o---o
712 +# / \ / \
713 +# A o X ? F
714 +# \ / \ /
715 +# o---o
716 +# C E
717 +#
718 +# Commit A: new file: a
719 +# Commit B: rename a->b, add c
720 +# Commit C: rename a->c
721 +# Commit D: merge B&C, keeping A:a and B:c
722 +# Commit E: merge B&C, keeping A:a and slightly modified c from B
723 +#
724 +# Merging commits D & E should result in no conflict. The virtual merge
725 +# base of B & C needs to not delete B:c for that to work, though...
726 +
727 +test_expect_success 'setup criss-cross+rename/rename/add-dest + simple modify' '
728 + git rm -rf . &&
729 + git clean -fdqx &&
730 + rm -rf .git &&
731 + git init &&
732 +
733 + >a &&
734 + git add a &&
735 + git commit -m A &&
736 + git tag A &&
737 +
738 + git checkout -b B A &&
739 + git mv a b &&
740 + printf "1\n2\n3\n4\n5\n6\n7\n" >c &&
741 + git add c &&
742 + git commit -m B &&
743 +
744 + git checkout -b C A &&
745 + git mv a c &&
746 + git commit -m C &&
747 +
748 + git checkout B^0 &&
749 + git merge --no-commit -s ours C^0 &&
750 + git mv b a &&
751 + git commit -m "D is like B but renames b back to a" &&
752 + git tag D &&
753 +
754 + git checkout B^0 &&
755 + git merge --no-commit -s ours C^0 &&
756 + git mv b a &&
757 + echo 8 >>c &&
758 + git add c &&
759 + git commit -m "E like D but has mod in c" &&
760 + git tag E
761 +'
762 +
763 +test_expect_failure 'virtual merge base handles rename/rename(1to2)/add-dest' '
764 + git checkout D^0 &&
765 +
766 + git merge -s recursive E^0 &&
767 +
768 + test 2 -eq $(git ls-files -s | wc -l) &&
769 + test 0 -eq $(git ls-files -u | wc -l) &&
770 + test 0 -eq $(git ls-files -o | wc -l) &&
771 +
772 + test $(git rev-parse HEAD:a) = $(git rev-parse A:a) &&
773 + test $(git rev-parse HEAD:c) = $(git rev-parse E:c)
774 +'
775 +
776 test_done