git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: What's cooking in git.git (Apr 2012, #05; Thu, 12)
@ 2012-04-16  6:26 Michal Kiedrowicz
  2012-04-16 14:57 ` Linus Torvalds
  0 siblings, 1 reply; 22+ messages in thread
From: Michal Kiedrowicz @ 2012-04-16  6:26 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Linus Torvalds, git

Junio C Hamano <gitster@pobox.com> wrote:

> * lt/octopus-simplify (2012-04-12) 1 commit
>  - Make 'git merge' simplify parents earlier
>
> Octopus merge strategy did not reduce heads that are recorded in the
> final commit.  This was done off-list.

Heh, this seems to fix the issue I reported in [1], except... it
doesn't work for the testcase I posted :).  The problem is that this
commit makes Git 'fast-forward' to the first commit from remoteheads,
not from the reduced heads. See:


	$ git init /tmp/merge
	Initialized empty Git repository in /tmp/merge/.git/
	$ cd /tmp/merge
	$ echo a>>a && git add a && git commit -m first
	[master (root-commit) 7422615] first
	 1 file changed, 1 insertion(+)
	 create mode 100644 a
	$ echo a>>a && git add a && git commit -m second
	[master 0ba02e5] second
	 1 file changed, 1 insertion(+)
	$ echo a>>a && git add a && git commit -m third
	[master 9bd11ac] third
	 1 file changed, 1 insertion(+)
	$ git checkout master~2
	HEAD is now at 7422615... first
	# This is OK:
	$ git merge master master~1 
	Updating 7422615..9bd11ac
	Fast-forward
	 a |    2 ++
	 1 file changed, 2 insertions(+)
	$ git checkout master~2
	Previous HEAD position was 9bd11ac... third
	HEAD is now at 7422615... first
	# This is not OK:
	$ git merge master~1 master 
	Updating 7422615..0ba02e5
	Fast-forward
	 a |    1 +
	 1 file changed, 1 insertion(+)

Ths following patch fixes that.

[1] http://permalink.gmane.org/gmane.comp.version-control.git/190625


Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
(if this fix need a signed-off)
---

diff --git a/builtin/merge.c b/builtin/merge.c
index f5947b9..075c99b 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1388,13 +1388,13 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
                if (verbosity >= 0)
                        printf(_("Updating %s..%s\n"),
                                hex,
-                               find_unique_abbrev(remoteheads->item->object.sha1,
+                               find_unique_abbrev(parents->item->object.sha1,
                                DEFAULT_ABBREV));
                strbuf_addstr(&msg, "Fast-forward");
                if (have_message)
                        strbuf_addstr(&msg,
                                " (no commit created; -m option ignored)");
-               commit = remoteheads->item;
+               commit = parents->item;
                if (!commit) {
                        ret = 1;
                        goto done;

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2012-04-19  5:20 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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         ` [PATCH 1/4] git-merge: test octopus with redundant parents Junio C Hamano
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

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).