git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: "Michał Kiedrowicz" <michal.kiedrowicz@gmail.com>
Subject: [PATCH 1/4] git-merge: test octopus with redundant parents
Date: Tue, 17 Apr 2012 13:34:43 -0700	[thread overview]
Message-ID: <1334694886-27756-2-git-send-email-gitster@pobox.com> (raw)
In-Reply-To: <1334694886-27756-1-git-send-email-gitster@pobox.com>

From: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>

This happens when git merge is run to merge multiple commits that are
descendants of current HEAD (or are HEAD).  We've hit this while updating
master to origin/master but accidentaly we called (while being on master):

	$ git merge master origin/master

Here is a minimal testcase:

	$ git init a && cd a
	$ echo a >a && git add a
	$ git commit -minitial
	$ echo b >a && git add a
	$ git commit -msecond
	$ git checkout master^

	$ git merge master master
	Fast-forwarding to: master
	Already up-to-date with master
	Merge made by the 'octopus' strategy.
	 a |    2 +-
	  1 files changed, 1 insertions(+), 1 deletions(-)

	$ git cat-file commit HEAD
	tree eebfed94e75e7760540d1485c740902590a00332
	parent bd679e85202280b263e20a57639a142fa14c2c64
	author Michał Kiedrowicz <michal.kiedrowicz@gmail.com> 1329132996 +0100
	committer Michał Kiedrowicz <michal.kiedrowicz@gmail.com> 1329132996 +0100

	Merge branches 'master' and 'master' into HEAD

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t6028-merge-up-to-date.sh |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/t/t6028-merge-up-to-date.sh b/t/t6028-merge-up-to-date.sh
index a91644e..824fca5 100755
--- a/t/t6028-merge-up-to-date.sh
+++ b/t/t6028-merge-up-to-date.sh
@@ -16,7 +16,12 @@ test_expect_success setup '
 	test_tick &&
 	git commit -m second &&
 	git tag c1 &&
-	git branch test
+	git branch test &&
+	echo third >file &&
+	git add file &&
+	test_tick &&
+	git commit -m third &&
+	git tag c2
 '
 
 test_expect_success 'merge -s recursive up-to-date' '
@@ -74,4 +79,14 @@ test_expect_success 'merge -s subtree up-to-date' '
 
 '
 
+test_expect_failure 'merge fast-forward octopus' '
+
+	git reset --hard c0 &&
+	test_tick &&
+	git merge c1 c2
+	expect=$(git rev-parse c2) &&
+	current=$(git rev-parse HEAD) &&
+	test "$expect" = "$current"
+'
+
 test_done
-- 
1.7.10.332.g1863c

  reply	other threads:[~2012-04-17 20:34 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-16  6:26 What's cooking in git.git (Apr 2012, #05; Thu, 12) Michal Kiedrowicz
2012-04-16 14:57 ` Linus Torvalds
2012-04-16 17:29   ` Junio C Hamano
2012-04-16 17:50     ` Linus Torvalds
2012-04-16 22:03       ` Junio C Hamano
2012-04-17 20:34       ` [PATCH 0/4] merge: reduce set of parents consistently Junio C Hamano
2012-04-17 20:34         ` Junio C Hamano [this message]
2012-04-17 20:34         ` [PATCH 2/4] builtin/merge.c: remove "remoteheads" global variable Junio C Hamano
2012-04-17 20:34         ` [PATCH 3/4] builtin/merge.c: collect other parents early Junio C Hamano
2012-04-17 20:34         ` [PATCH 4/4] builtin/merge.c: reduce " Junio C Hamano
2012-04-16 17:36   ` What's cooking in git.git (Apr 2012, #05; Thu, 12) Junio C Hamano
2012-04-16 18:02     ` Linus Torvalds
2012-04-16 18:33       ` Linus Torvalds
2012-04-16 21:32         ` Michał Kiedrowicz
2012-04-17  1:22           ` Linus Torvalds
2012-04-17 18:25             ` [PATCH] git-merge: Reduce heads before trying to merge them Michał Kiedrowicz
2012-04-17 18:52               ` Junio C Hamano
2012-04-17 20:09                 ` Linus Torvalds
2012-04-17 20:48                   ` Junio C Hamano
2012-04-18 18:14                     ` Michał Kiedrowicz
2012-04-18 20:20                       ` Junio C Hamano
2012-04-19  5:19                         ` Junio C Hamano

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=1334694886-27756-2-git-send-email-gitster@pobox.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=michal.kiedrowicz@gmail.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).