git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Sverre Hvammen Johansen" <hvammen@gmail.com>
To: git@vger.kernel.org
Subject: Re: Merging using only fast-forward
Date: Thu, 17 Jan 2008 22:58:50 -0800	[thread overview]
Message-ID: <402c10cd0801172258p9a1a97bt682fa012fcebd13c@mail.gmail.com> (raw)
In-Reply-To: <402c10cd0801162253n6ab19f51y53d0baa16319adaa@mail.gmail.com>

On Jan 16, 2008 10:53 PM, Sverre Hvammen Johansen <hvammen@gmail.com> wrote:
> We need to consider cases where the branch we are merging with is an
> ancestor or an descendant of HEAD.  The patch only take descendants
> into account.  There may also be more than one branch we are merging
> with.  All these cases must be considered.  In the case of an octopus, the
> cases are slightly more complicated.

I have been testing octopus merges and figured it is not very smart with
respect to fast forward.  I would like it to do a fast forward whenever it
makes sense to do that.  Consider the following:

     -- c1 -- A
   /              /  \
c0 -- c2 --      C
   \              \  /
     -- c3 -- B

A is a merge between c1 and c2, B is a merge between c2 and c3, and C is a
merge between A and B.

c1 merged with A does a fast forward to A, A merged with C does a fast forward
to C, but an octopus merge of c1 with A and C does not fast forward to
C.  I would
expect it to fast forward to C.  The commit graph above have several other cases
where an octopus merge can be reduced to a fast forward or a recursive merge.

I suggest a separate pass before we choose merge strategy.  Remove commits
that can be fast forwarded to any of the other commits from the
equation and fast
forward the current branch if possible.  The remaining commits are then taken
into consideration.  This may reduce the number of commits and thus result in
a fast forward or another merge strategy.

I intend to make the patch for the option --ff-only as simple as
possible, where it
will fail where more than two commits are involved.  If the above suggested pass
is implemented it should also take affect for --ff-only.

Does this make sense?

-- 
Sverre Hvammen Johansen

  reply	other threads:[~2008-01-18  6:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-16 15:54 Merging using only fast-forward Sverre Hvammen Johansen
2008-01-16 16:27 ` Randal L. Schwartz
2008-01-16 20:31   ` Junio C Hamano
2008-01-16 22:38     ` Sverre Hvammen Johansen
2008-01-16 22:49       ` Junio C Hamano
2008-01-17  6:53     ` Sverre Hvammen Johansen
2008-01-18  6:58       ` Sverre Hvammen Johansen [this message]
2008-01-18 21:25         ` Junio C Hamano
2008-01-19 10:28           ` Sverre Hvammen Johansen
2008-01-19 10:38             ` Sverre Hvammen Johansen
2008-01-19 10:43             ` Junio C Hamano
     [not found]               ` <402c10cd0801190427o62493073s408959aa5701ca86@mail.gmail.com>
2008-01-19 12:30                 ` Sverre Hvammen Johansen
2008-01-19 12:58                   ` Please don't reply to this thread Sverre Hvammen Johansen
2008-01-19 12:39               ` Merging using only fast-forward Sverre Hvammen Johansen
2008-01-21  6:26               ` Sverre Hvammen Johansen

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=402c10cd0801172258p9a1a97bt682fa012fcebd13c@mail.gmail.com \
    --to=hvammen@gmail.com \
    --cc=git@vger.kernel.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 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).