git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Keeping <john@keeping.me.uk>
To: "Stenberg Jim (2)" <jim.stenberg.2@volvo.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Git potential bug with fork-point
Date: Sat, 7 Nov 2015 16:01:20 +0000	[thread overview]
Message-ID: <20151107160120.GG19802@serenity.lan> (raw)
In-Reply-To: <a3db24afbc3247c3a8466c8d7ce0c785@SEGOTNC5113-N2.vcn.ds.volvo.net>

On Mon, Nov 02, 2015 at 06:27:52AM +0000, Stenberg Jim (2) wrote:
> My problem:
> "Git merge-base --fork-point" acts unexpected when I refer to remote
> branches (typically "origin/".) With unexpected I mean that if I swap
> the position of the two references that the function takes as argument
> I get different results.  I highly suspect that this isn't a feature
> but a bug, or maybe I'm using the function in a way it wasn't intended
> to be used.
> I don't need you to fix it (swapping the arguments solves it), I just
> want you to be aware of it.
> 
> History & procedure:
> When  I was working on my automatic build script I came across the
> oddity that "Git merge-base --fork-point" behaved differently
> depending on the order in which the two references are passed.

I think this is expected.  The documentation for `--fork-point` says:

	git merge-base --fork-point <ref> [<commit>]

	Find the point at which a branch (or any history that leads to
	<commit>) forked from another branch (or any reference) <ref>.
	This does not just look for the common ancestor of the two
	commits, but also takes into account the reflog of <ref> to see
	if the history leading to <commit> forked from an earlier
	incarnation of the branch <ref> (see discussion on this mode
	below).

Clearly the order of the arguments matters because the reflog is only
inspected for the `<ref>` argument.  Since the reflog is involved this
also means that the results are likely to be different between separate
copies of the same repository.

I suspect you do not want to be using `--fork-point` in your build
script; it is intended to help `git rebase` recover from history being
rewritten and if you do not need that behaviour you are probably better
off using the normal `git merge-base <commit> <commit>` mode, which
should give consistent results regardless of the order of the commits.

      reply	other threads:[~2015-11-07 16:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-02  6:27 Git potential bug with fork-point Stenberg Jim (2)
2015-11-07 16:01 ` John Keeping [this message]

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=20151107160120.GG19802@serenity.lan \
    --to=john@keeping.me.uk \
    --cc=git@vger.kernel.org \
    --cc=jim.stenberg.2@volvo.com \
    /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).