git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: What's cooking in git.git (Apr 2012, #05; Thu, 12)

From
Michal Kiedrowicz <michal.kiedrowicz@gmail.com>
Date
Apr 16, 2012, 06:26 UTC
Message-ID
<20120416082641.5d239ef6@mkiedrowicz.ivo.pl>
Junio C Hamano <gitster@pobox.com> wrote:
Show 5 quoted lines
> * 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;
Next: Linus Torvalds
Message 1 of 22 in “Re: What's cooking in git.git (Apr 2012, #05; Thu, 12)”
  1. Michal KiedrowiczApr 16, 2012
  2. Linus TorvaldsApr 16, 2012
  3. Junio C HamanoApr 16, 2012
  4. Linus TorvaldsApr 16, 2012
  5. Junio C HamanoApr 16, 2012
  6. 0/4 merge: reduce set of parents consistentlyJunio C Hamano, Apr 17, 2012
  7. 1/4 git-merge: test octopus with redundant parentsJunio C Hamano, Apr 17, 2012
  8. 2/4 builtin/merge.c: remove "remoteheads" global variableJunio C Hamano, Apr 17, 2012
  9. 3/4 builtin/merge.c: collect other parents earlyJunio C Hamano, Apr 17, 2012
  10. 4/4 builtin/merge.c: reduce parents earlyJunio C Hamano, Apr 17, 2012
  11. Junio C HamanoApr 16, 2012
  12. Linus TorvaldsApr 16, 2012
  13. Linus TorvaldsApr 16, 2012
  14. Michał KiedrowiczApr 16, 2012
  15. Linus TorvaldsApr 17, 2012
  16. git-merge: Reduce heads before trying to merge themMichał Kiedrowicz, Apr 17, 2012
  17. Junio C HamanoApr 17, 2012
  18. Linus TorvaldsApr 17, 2012
  19. Junio C HamanoApr 17, 2012
  20. Michał KiedrowiczApr 18, 2012
  21. Junio C HamanoApr 18, 2012
  22. Junio C HamanoApr 19, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.