From b630b8147055a6fd56edfdf3ba85e9dea27dd397 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Thu, 11 Aug 2011 23:20:28 -0600 Subject: [PATCH] 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 Signed-off-by: Junio C Hamano --- t/t6036-recursive-corner-cases.sh | 69 +++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/t/t6036-recursive-corner-cases.sh b/t/t6036-recursive-corner-cases.sh index d8c6bdacc..e9c7a25e1 100755 --- a/t/t6036-recursive-corner-cases.sh +++ b/t/t6036-recursive-corner-cases.sh @@ -704,4 +704,73 @@ test_expect_failure 'detect rename/rename/add-source for virtual merge-base' ' test "$(cat a)" = "$(printf "1\n2\n3\n4\n5\n6\n7\n8\n")" ' +# +# criss-cross with rename/rename(1to2)/add-dest + simple modify: +# +# B D +# o---o +# / \ / \ +# A o X ? F +# \ / \ / +# o---o +# C E +# +# Commit A: new file: a +# Commit B: rename a->b, add c +# Commit C: rename a->c +# Commit D: merge B&C, keeping A:a and B:c +# Commit E: merge B&C, keeping A:a and slightly modified c from B +# +# Merging commits D & E should result in no conflict. The virtual merge +# base of B & C needs to not delete B:c for that to work, though... + +test_expect_success 'setup criss-cross+rename/rename/add-dest + simple modify' ' + git rm -rf . && + git clean -fdqx && + rm -rf .git && + git init && + + >a && + git add a && + git commit -m A && + git tag A && + + git checkout -b B A && + git mv a b && + printf "1\n2\n3\n4\n5\n6\n7\n" >c && + git add c && + git commit -m B && + + git checkout -b C A && + git mv a c && + git commit -m C && + + git checkout B^0 && + git merge --no-commit -s ours C^0 && + git mv b a && + git commit -m "D is like B but renames b back to a" && + git tag D && + + git checkout B^0 && + git merge --no-commit -s ours C^0 && + git mv b a && + echo 8 >>c && + git add c && + git commit -m "E like D but has mod in c" && + git tag E +' + +test_expect_failure 'virtual merge base handles rename/rename(1to2)/add-dest' ' + git checkout D^0 && + + git merge -s recursive E^0 && + + test 2 -eq $(git ls-files -s | wc -l) && + test 0 -eq $(git ls-files -u | wc -l) && + test 0 -eq $(git ls-files -o | wc -l) && + + test $(git rev-parse HEAD:a) = $(git rev-parse A:a) && + test $(git rev-parse HEAD:c) = $(git rev-parse E:c) +' + test_done -- 2.30.2