Each side of a rename 2to1 could also be deleted by the other side. The code does not expect this. While it luckily works for files, it fails for symlinks as follow: CONFLICT (rename/rename): Rename a->c in HEAD. Rename b->c in C^0 Renaming a to c~HEAD and b to c~C^0 instead error: cannot read object 0000000000000000000000000000000000000000 'c~C^0' Signed-off-by: Nicolas Cavallari <nicolas.cavallari@xxxxxxxxxxxxxxxxxxxxxxx> --- t/t6042-merge-rename-corner-cases.sh | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/t/t6042-merge-rename-corner-cases.sh b/t/t6042-merge-rename-corner-cases.sh index 411550d2b..ea4e14cbd 100755 --- a/t/t6042-merge-rename-corner-cases.sh +++ b/t/t6042-merge-rename-corner-cases.sh @@ -575,4 +575,42 @@ test_expect_success 'rename/rename/add-dest merge still knows about conflicting test ! -f c ' +# Testcase setup for rename/rename/delete/delete (2in1, deleted): +# Commit A: new symlinks: a->alice b->bob +# Commit B: rename a->c, delete b +# Commit C: rename b->c, delete a +# +# We should not fail completely. + +test_expect_success 'setup rename/rename/delete/delete conflict' ' + git rm -rf . && + git clean -fdqx && + rm -rf .git && + git init && + + ln -s alice a && + ln -s bob b && + git add a b && + git commit -m A && + git tag A && + + git checkout -b B A && + git mv a c && + git rm b && + git commit -m B && + + git checkout -b C A && + git mv b c && + git rm a && + git commit -m C +' + +test_expect_failure 'rename/rename/delete/delete leaves at least one file' ' + git checkout B^0 && + test_must_fail git merge -s recursive C^0 && + + test -L "c~HEAD" && + test -L "c~C^0" +' + test_done -- 2.11.0