From: Jakub Narebski <jnareb@gmail.com>
To: Miklos Vajna <vmiklos@frugalware.org>
Cc: "SZEDER Gábor" <szeder@ira.uka.de>,
git@vger.kernel.org, "Shawn O. Pearce" <spearce@spearce.org>,
Johannes.Schindelin@gmx.de
Subject: Re: [PATCH] builtin-commit: avoid using reduce_heads()
Date: Fri, 26 Sep 2008 09:17:39 -0700 (PDT) [thread overview]
Message-ID: <m37i8y3mqt.fsf@localhost.localdomain> (raw)
In-Reply-To: <20080926151517.GV23137@genesis.frugalware.org>
Miklos Vajna <vmiklos@frugalware.org> writes:
> OK, here is the scenario.
>
> The basic problemis that if it's git-commit that creates the merge
> commit and not git-merge, then git-commit does not "know" that git-merge
> was invoked using --no-ff.
>
> --no-ff means that if reduce_heads() removes a parent, that will be a
> problem, since the resulting commit will no longer be a merge commit.
>
> I think we can't avoid storing this info in a MERGE_MODE file, because
> we have to add HEAD to the list of parents in case --no-ff is used, but
> we should not do so in case it's reachable from existing heads and
> --no-ff is not used.
>
> I'll send a patch that does this in a bit.
The following is summary of short dicussion about this issue on #git
see: http://colabti.org/irclogger/irclogger_log/git?date=2008-09-26,Fri#l1176
The problem is that sometimes git-commit finishes doing the merge, be
it use of --no-commit option, or a conflict occurred; depending on
whether git-merge was invoked with or without --no-ff (--ff=never)
option it should recurd reduced or non-reduced heads.
The problem for example occurs in the following situation:
.---.---.---. <--- a <--- HEAD
|\
| \-1---2 <--- b
\
\--x---y <--- c
$ git merge b c
/------------- b
v
.---.---.---.---1---2---M <--- a <--- HEAD
\ /
\--x---y-/ <--- c
$ git merge --no-ff b c
.---.---.---.---------M <--- a <--- HEAD
|\ /|
| \-1---2 | <--- b
\ /
\--x---y/ <--- c
We can select one of the following solutions:
1. As proposed above save git-merge options, for example in MERGE_MODE
or MERGE_OPTS file, so git-commit knows what options to use if it
was invoked to finish a merge.
2. git-merge saves _reduced_ heads in MERGE_HEAD, and git-commit
reduces only HEAD, unless it is in MERGE_HEAD. This means that
git-commit uses the following pseudo-code
if (resolve_ref(HEAD) == MERGE_HEAD[0]) {
/* non fast-forward case */
merge HEAD + MERGE_HEAD
} else {
reduce_HEAD_maybe()
merge [HEAD] + MERGE_HEAD
}
This has the advantage that it doesn't change MERGE_HEAD semantic
for simple merge which did not began as octopus
3. Remove reduce_heads() from git-commit entirely, and record in
MERGE_HEAD (or rather now MERGE_HEADS) _all_ _reduced_ heads.
_All_ means that HEAD is included in MERGE_HEAD if it is not
reduced, _reduced_ means that only non-dependent heads are in
MERGE_HEAD. This for example means that for simple non-octopus
merge case MERGE_HEAD/MERGE_HEADS now contain _all_ parents,
and not only other side of merge.
This solution has the advantage of being clear solution, clarifying
semantic of MERGE_HEAD (currently HEAD is used both as target, i.e.
where merge is to be recorded, and as one of heads to merge/to
consider), and making it possible to separate layers: git-merge
is about merging, git-commit doesn't need to know anything about
merging.
The disadvantage is that it changes format (well, semantic) of
MERGE_HEAD, possibly breaking users' scripts; perhaps some of
git commands like "git log --merge" or "git diff --merge" should
be updated on such change.
--
Jakub Narebski
Poland
ShadeHawk on #git
next prev parent reply other threads:[~2008-09-26 16:18 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-25 23:50 [BUG] merge --no-ff --no-commit && commit SZEDER Gábor
2008-09-26 0:35 ` [PATCH] builtin-commit: avoid using reduce_heads() Miklos Vajna
2008-09-26 1:03 ` SZEDER Gábor
2008-09-26 6:24 ` Miklos Vajna
2008-09-26 15:15 ` Miklos Vajna
2008-09-26 15:20 ` [PATCH] builtin-commit: avoid always " Miklos Vajna
2008-09-26 15:52 ` Shawn O. Pearce
2008-09-26 19:37 ` Miklos Vajna
2008-10-03 2:35 ` Shawn O. Pearce
2008-10-03 12:04 ` Miklos Vajna
2008-10-03 14:59 ` Shawn O. Pearce
2008-10-05 19:51 ` Miklos Vajna
2008-10-06 14:19 ` Shawn O. Pearce
2008-10-03 15:09 ` [PATCH] builtin-commit: use reduce_heads() only when appropriate SZEDER Gábor
2008-10-05 19:43 ` Miklos Vajna
2008-09-26 16:17 ` Jakub Narebski [this message]
2008-09-26 19:31 ` [PATCH] builtin-commit: avoid using reduce_heads() Miklos Vajna
2008-09-26 23:51 ` Jakub Narebski
2008-09-29 15:07 ` Miklos Vajna
2008-09-29 18:18 ` Miklos Vajna
2008-09-29 18:44 ` Jakub Narebski
2008-09-27 0:16 ` SZEDER Gábor
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=m37i8y3mqt.fsf@localhost.localdomain \
--to=jnareb@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=spearce@spearce.org \
--cc=szeder@ira.uka.de \
--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.