From: Junio C Hamano <gitster@pobox.com>
To: Daniel Barkalow <barkalow@iabervon.org>
Cc: Stephan Beyer <s-beyer@gmx.net>,
Miklos Vajna <vmiklos@frugalware.org>,
git@vger.kernel.org
Subject: Re: [PATCH (1b)] merge-recursive.c: Add more generic merge_recursive_generic()
Date: Wed, 13 Aug 2008 12:55:47 -0700 [thread overview]
Message-ID: <7v3al8ofjw.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <alpine.LNX.1.00.0808131333230.19665@iabervon.org> (Daniel Barkalow's message of "Wed, 13 Aug 2008 13:54:16 -0400 (EDT)")
Daniel Barkalow <barkalow@iabervon.org> writes:
>> Puhh, I've not dug into merging stuff that deep, but for me it does not
>> look that this can be done in a useful way, i.e. merge_working_tree()
>> does not do a recursive merge.
>
> Ah, true. It's actually doing a single merge in the way that
> merge_recursive would do a single merge. I think it ought to be doing
> a recursive merge, but that's probably a change for later, anyway. (This
> is for -m, which essentially picks the uncommited changes versus the old
> branch, applied to the new branch uncommitted)
Why would you think it should be doing a recursive merge? It shouldn't.
Think of builtin-merge-recursive.c::merge_trees() as a fancier version of
3-tree variant of "unpack_trees()", with -m and -u option.
When you want to perform an exact three-way merge (i.e. you have two
states O and B, and you want to apply changes between O and B to your
state A, and you _precisely_ know what O is) that's the interface you
would want to use, not the recursive one. The recursive behaviour is
desirable only when you have A and B and need to infer where O should be,
and/or there are multiple O's to deal with (i.e. running "git-merge B"
when you are at A).
In all the potential users of merge-recursive machinery, namely, "revert",
"cherry-pick", "stash apply", "am -3", and "checkout -m", you know what
single common tree to use for your three-way merge. These operations,
when done with direct C call into merge machinery, should NOT be using the
"recursive" one.
When you switch branches from A to B with checkout, and you have local
changes A', then you would want an exact three-way merge that modifies B
by applying changes from A to A'.
When you cherry-pick commit C on top of your current HEAD, you want an exact
three-way merge that modifies your HEAD by applying changes from C^ to C,
and you do not want the merge machinery to take ancestry relation (and
criss cross merges) between HEAD and C into account at all.
The scripted version of revert/cherry-pick used git-merge-recursive
because that is the Porcelain API available, and the current C-rewrite
uses it as well, but if we are rewriting it to call merge-recursive
machinery directly, it should be making a single merge request to
merge_trees(), not "recursive" one.
next prev parent reply other threads:[~2008-08-13 19:57 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-10 13:20 [PATCH 0/2] Avoid run_command() for recursive in builtin-merge Miklos Vajna
2008-08-10 13:20 ` [PATCH 1/2] merge-recursive: prepare merge_recursive() to be called from builtins Miklos Vajna
2008-08-11 15:13 ` Stephan Beyer
2008-08-11 16:46 ` Miklos Vajna
2008-08-11 19:53 ` Junio C Hamano
2008-08-11 20:46 ` Stephan Beyer
2008-08-10 13:20 ` [PATCH 2/2] builtin-merge: avoid run_command_v_opt() for recursive Miklos Vajna
2008-08-11 18:47 ` Junio C Hamano
2008-08-11 19:07 ` Miklos Vajna
2008-08-11 20:03 ` Junio C Hamano
2008-08-11 20:45 ` Miklos Vajna
2008-08-11 20:48 ` [PATCH] Add a new test to ensure merging a submodule is handled properly Miklos Vajna
2008-08-11 15:03 ` [PATCH] builtin-revert.c: Make use of merge_recursive() Stephan Beyer
2008-08-11 15:47 ` Johannes Schindelin
2008-08-11 19:01 ` Stephan Beyer
2008-08-11 19:09 ` Miklos Vajna
2008-08-11 21:44 ` [PATCH] builtin-revert: " Stephan Beyer
2008-08-11 21:46 ` Stephan Beyer
2008-08-11 22:33 ` Junio C Hamano
2008-08-11 23:27 ` Junio C Hamano
2008-08-11 23:47 ` Stephan Beyer
2008-08-11 23:52 ` Junio C Hamano
2008-08-12 16:45 ` [PATCH] Split out merge_recursive() to merge-recursive.c Miklos Vajna
2008-08-12 17:56 ` Stephan Beyer
2008-08-12 21:40 ` Miklos Vajna
2008-08-12 20:13 ` [PATCH (1b)] merge-recursive.c: Add more generic merge_recursive_generic() Stephan Beyer
2008-08-12 20:14 ` [PATCH (2)] Make builtin-revert.c use merge_recursive_generic() Stephan Beyer
2008-08-12 21:44 ` [PATCH (1b)] merge-recursive.c: Add more generic merge_recursive_generic() Miklos Vajna
2008-08-13 17:26 ` Stephan Beyer
2008-08-13 20:13 ` Miklos Vajna
2008-08-13 3:17 ` Daniel Barkalow
2008-08-13 17:29 ` Stephan Beyer
2008-08-13 17:54 ` Daniel Barkalow
2008-08-13 19:55 ` Junio C Hamano [this message]
2008-08-13 20:05 ` Stephan Beyer
2008-08-13 20:36 ` Daniel Barkalow
2008-08-13 21:45 ` Junio C Hamano
2008-08-14 3:17 ` [PATCH] Split out merge_recursive() to merge-recursive.c 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=7v3al8ofjw.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=barkalow@iabervon.org \
--cc=git@vger.kernel.org \
--cc=s-beyer@gmx.net \
--cc=vmiklos@frugalware.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.