git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: [PATCH] rerere: demonstrate a weakness with identical conflicts in different files
Date: Wed, 11 Aug 2010 14:16:21 +0200	[thread overview]
Message-ID: <4C629495.60105@viscovery.net> (raw)

From: Johannes Sixt <j6t@kdbg.org>

When code sections are duplicated in different files and identical
conflicts arise simultaneously in these sections, then rerere resolves only
the first one and leaves the others unresolved.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 I encounter this situation several times a year, and every now and then
 it is particularly annoying because the conflicts are extensive.

 I would appreciate if you could have a look whether this is fixed
 easily. I tried myself, but I can't find the point where the
 subsequent conflicts are ignored.

 -- Hannes

 t/t4208-rerere-dup.sh |   77 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 77 insertions(+), 0 deletions(-)
 create mode 100755 t/t4208-rerere-dup.sh

diff --git a/t/t4208-rerere-dup.sh b/t/t4208-rerere-dup.sh
new file mode 100755
index 0000000..34c182a
--- /dev/null
+++ b/t/t4208-rerere-dup.sh
@@ -0,0 +1,77 @@
+#!/bin/sh
+#
+# Copyright (c) 2010 Johannes Sixt
+#
+
+test_description='test git rerere when sections of files are duplicated,
+and identical conflicts arise in these sections simultaneously.
+'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+	cat > a1 <<- EOF &&
+	alpha
+	beta
+	gamma
+	EOF
+	sed -e s/alpha/ALPHA/ <a1 >a2 &&
+
+	git add a1 a2 &&
+	git commit -q -a -m initial &&
+
+	git checkout -b first &&
+	cat > a1 <<- EOF &&
+	alpha
+	BETA
+	gamma
+	EOF
+	sed -e s/alpha/ALPHA/ <a1 >a2 &&
+	git commit -q -a -m first &&
+
+	git checkout master &&
+	cat > a1 <<- EOF &&
+	alpha
+	----
+	gamma
+	EOF
+	sed -e s/alpha/ALPHA/ <a1 >a2 &&
+	git commit -q -a -m master &&
+	git config rerere.enabled true
+'
+
+test_expect_success 'merge records only one conflict' '
+	test_must_fail git merge first &&
+	sha1=$(ls .git/rr-cache) &&
+	test $(echo $sha1 | wc -w) = 1
+'
+
+test_expect_success 'record a resolution' '
+	cat > a1 <<- EOF &&
+	alpha
+	--beta--
+	gamma
+	EOF
+	sed -e s/alpha/ALPHA/ <a1 >a2 &&
+	git rerere 2>actual
+'
+
+test_expect_success 'postimage must exist' '
+	test -f .git/rr-cache/$sha1/postimage
+'
+
+test_expect_success 'same resolution recorded twice' '
+	test $(grep "Recorded resolution" actual | wc -l) = 2 &&
+	test $(ls .git/rr-cache | wc -w) = 1
+'
+
+test_expect_success 'repeat merge' '
+	git reset --hard &&
+	test_must_fail git merge first
+'
+
+test_expect_failure 'both files are resolved' '
+	! grep ===== a1 a2
+'
+
+test_done
-- 
1.7.2.63.g079547

             reply	other threads:[~2010-08-11 12:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-11 12:16 Johannes Sixt [this message]
2010-08-11 23:35 ` [PATCH] rerere: demonstrate a weakness with identical conflicts in different files Junio C Hamano
2010-08-12  2:50   ` Junio C Hamano
2010-08-12  7:28     ` Johannes Sixt

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C629495.60105@viscovery.net \
    --to=j.sixt@viscovery.net \
    --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.
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 NNTP newsgroup(s).