git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Hord <hordp@cisco.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Martin von Zweigbergk" <martin.von.zweigbergk@gmail.com>,
	"David Aguilar" <davvid@gmail.com>,
	"Brandon Casey" <casey@nrlssc.navy.mil>,
	"Brian Gernhardt" <brian@gernhardtsoftware.com>,
	"Bryan Larsen" <bryan@larsen.st>,
	"Eric Wong" <normalperson@yhbt.net>,
	"H.Merijn Brand" <h.m.brand@xs4all.nl>,
	"Jeff King" <peff@peff.net>,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	"Jonathan Nieder" <jrnieder@gmail.com>,
	"Olivier Marin" <dkr@freesurf.fr>,
	"Simon 'corecode' Schubert" <corecode@fs.ei.tum.de>,
	"Stephan Beyer" <s-beyer@gmx.net>,
	"SZEDER Gábor" <szeder@ira.uka.de>
Subject: [PATCH/RFC] Add two basic tests for "rerere remaining"
Date: Fri, 15 Jul 2011 17:05:05 -0400	[thread overview]
Message-ID: <4E20AB81.3050005@cisco.com> (raw)
In-Reply-To: <4E20A0D9.4030404@cisco.com>

After a 'git stash apply' which results in a conflicted file,
git mergetool can be used to work on the conflicts.  However,
when rerere.enabled=true, git mergetool determines the list
of unresolved file conflicts by asking 'git rerere remaining'.

There is a problem with this because rerere does not record
the 'git stash apply' conflicts and so 'git rerere remaining'
does not report them.

Demonstrate this failing so it can be studied and addressed.

Also add a very basic test for 'git rerere remaining' after
a normal merge conflict.

Signed-off-by: Phil Hord <hordp@cisco.com>
---

This patch adds one failing test and one working test.

The working test is very limited and just repeats the
same test as the 'rerere status' one for 'rerere remaining'.
A better test should probably be added, one that demonstrates
and confirms the differences between 'rerere status' and
'rerere remaining'.  I don't understand this difference
well enough to code that test, though.
 
 t/t4200-rerere.sh |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
index 36255d6..a96ebad 100755
--- a/t/t4200-rerere.sh
+++ b/t/t4200-rerere.sh
@@ -96,10 +96,42 @@ test_expect_success 'rerere.enabled works, too' '
 	grep ^=======$ $rr/preimage
 '
 
+test_expect_success 'set up conflicted stash apply' '
+	rm -rf .git/rr-cache &&
+	git config rerere.enabled true &&
+
+	git reset --hard &&
+	git checkout master &&
+	git show second:a1 >a1 &&
+
+	# should be 1 modified file and no unmerged files
+	test $(git ls-files -m |wc -l) = 1 &&
+	test $(git ls-files -u |wc -l) = 0 &&
+
+	git stash save &&
+	git checkout first &&
+
+	test_must_fail git stash apply &&
+
+	# there should be three states for one unresolved file
+	cnt=$(git ls-files -u | wc -l) &&
+	echo $cnt &&
+	test $cnt = 3
+'
+
+test_expect_failure 'rerere-remaining correctly reports stash-apply conflicts' '
+	echo a1 >expect &&
+	git rerere status >out &&
+	test_cmp expect out &&
+	git rerere remaining >out &&
+	test_cmp expect out
+'
+
 test_expect_success 'set up rr-cache' '
 	rm -rf .git/rr-cache &&
 	git config rerere.enabled true &&
 	git reset --hard &&
+	git checkout second &&
 	test_must_fail git merge first &&
 	sha1=$(perl -pe "s/	.*//" .git/MERGE_RR) &&
 	rr=.git/rr-cache/$sha1
@@ -160,6 +192,12 @@ test_expect_success 'rerere status' '
 	test_cmp expect out
 '
 
+test_expect_success 'rerere remaining' '
+	echo a1 >expect &&
+	git rerere remaining >out &&
+	test_cmp expect out
+'
+
 test_expect_success 'first postimage wins' '
 	git show first:a1 | sed "s/To die: t/To die! T/" >expect &&
 
-- 
1.7.6.8.gd2879

  reply	other threads:[~2011-07-15 21:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-14 17:09 rerere affects handling of git-stash-pop merge conflicts Phil Hord
2011-07-15 20:19 ` Phil Hord
2011-07-15 21:05   ` Phil Hord [this message]
2011-07-16  2:19 ` Martin von Zweigbergk
2011-07-17 21:59   ` Junio C Hamano
2011-07-25 22:31     ` [PATCH] Add two basic tests for "rerere remaining" Phil Hord

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=4E20AB81.3050005@cisco.com \
    --to=hordp@cisco.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=brian@gernhardtsoftware.com \
    --cc=bryan@larsen.st \
    --cc=casey@nrlssc.navy.mil \
    --cc=corecode@fs.ei.tum.de \
    --cc=davvid@gmail.com \
    --cc=dkr@freesurf.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=h.m.brand@xs4all.nl \
    --cc=jrnieder@gmail.com \
    --cc=martin.von.zweigbergk@gmail.com \
    --cc=normalperson@yhbt.net \
    --cc=peff@peff.net \
    --cc=s-beyer@gmx.net \
    --cc=szeder@ira.uka.de \
    /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).