Junio C Hamano <[email protected]> writes:
> Jeff King <[email protected]> writes:
>> On Mon, Apr 20, 2015 at 11:59:04AM -0700, Junio C Hamano wrote:
>>
>>> Unfortunately, "git merge"'s parsing of FETCH_HEAD forgets that we
>>> may be creating an Octopus. Otherwise the above should work well.
>>
>> That sounds like a bug we should fix regardless.
>
> But I am not sure how it should behave. "git fetch $there A B C"
> followed by "git merge FETCH_HEAD" merges only A, and I do not know
> if people have come to depend on this behaviour.
>
> I suspect there may be larger fallout from such a change, namely,
> what should "git log FETCH_HEAD" do? Should it traverse the history
> starting from all things that are not marked as not-for-merge, or
> should it just say "git rev-parse FETCH_HEAD" and use only the first
> one as the starting point?
So, I thought we may want to try this and see how it goes.
Tentatively, I am saying that "FETCH_HEAD" is a magic token
understood by "git merge", like "git merge <msg> HEAD commits..."
syntax was a magic that made "git merge" work differently from "git
merge -m <msg> <commits>..."; no changes to get_sha1() or anything
heavy like that is intended.
Earlier, we thought that it would just be the matter of turning
existing invocation of "git merge <msg> HEAD $commits..." in "git
pull" into "git merge -m <msg> $commits..." to deprecate the ugly
original "merge" command line syntax.
This unfortunately failed for two reasons.
* "-m <msg>" stops the editor from running; recent "git pull"
encourage the users to justify the merge in the log message,
and the auto-generated <msg> that comes from format-merge-msg
should still be shown to the user in the editor to be edited.
* "-m <msg>" also adds auto-generated summary when merge.log
configuration is enabled, but "git pull" calls "git merge" with
the message _with_ that log already in there.
Invoking "git merge FETCH_HEAD" (no messages fed by the caller) from
"git pull" almost works. "git merge" knows how to extract the name
of the repository and the branch from FETCH_HEAD to use in the merge
log message it auto-generates. However, this is done only for a
single branch; if you did "git pull $there topic-A topic-B", and
then invoked "git merge FETCH_HEAD" from there, we would end up
recording a merge with only one branch, which is not what we want.
This teaches "git merge FETCH_HEAD" that FETCH_HEAD may describe
multiple branches that were fetched for merging. With that, the
last step eradicates the "merge <msg> HEAD <commit>..." syntax from
our codebase, finally.
This may be rough in a few places and some patches that are done as
preparatory clean-up steps may want to be squashed into the patch
that follows them that implements the real change.
These patches are designed to apply on top of v2.2.2; I'll push them
out on 'pu' later, on 'jc/merge' topic.
Junio C Hamano (14):
merge: simplify code flow
t5520: style fixes
t5520: test pulling an octopus into an unborn branch
merge: clarify "pulling into void" special case
merge: do not check argc to determine number of remote heads
merge: small leakfix and code simplification
merge: clarify collect_parents() logic
merge: split reduce_parents() out of collect_parents()
merge: narrow scope of merge_names
merge: extract prepare_merge_message() logic out
merge: make collect_parents() auto-generate the merge message
merge: decide if we auto-generate the message early in
collect_parents()
merge: handle FETCH_HEAD internally
merge: deprecate 'git merge <message> HEAD <commit>' syntax
Documentation/git-merge.txt | 4 +
builtin/merge.c | 248 +++++++++++++++++++++++++++---------------
git-cvsimport.perl | 2 +-
git-pull.sh | 3 +-
t/t3402-rebase-merge.sh | 2 +-
t/t5520-pull.sh | 31 +++---
t/t6020-merge-df.sh | 2 +-
t/t6021-merge-criss-cross.sh | 6 +-
t/t9402-git-cvsserver-refs.sh | 2 +-
9 files changed, 188 insertions(+), 112 deletions(-)
--
2.4.0-rc3-238-g36f5934
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html