From: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 1/2] t6042: Add failing test for rename/rename/delete/delete.
Date: Fri, 3 Mar 2017 12:33:16 +0100 [thread overview]
Message-ID: <20170303113317.18575-1-nicolas.cavallari@green-communications.fr> (raw)
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@green-communications.fr>
---
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
next reply other threads:[~2017-03-03 11:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-03 11:33 Nicolas Cavallari [this message]
2017-03-03 11:33 ` [PATCH/RFC 2/2] merge-recursive: Handle rename/rename/delete/delete conflicts Nicolas Cavallari
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170303113317.18575-1-nicolas.cavallari@green-communications.fr \
--to=nicolas.cavallari@green-communications.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).