All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Brown <davidb@codeaurora.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Andreas Schwab <schwab@linux-m68k.org>,
	Brian Foster <brian.foster@maxim-ic.com>,
	git mailing list <git@vger.kernel.org>
Subject: Re: [Q] Determing if a commit is reachable from the HEAD ?
Date: Fri, 20 Jan 2012 15:33:35 -0800	[thread overview]
Message-ID: <20120120233335.GA20302@codeaurora.org> (raw)
In-Reply-To: <7v7h0mfahx.fsf@alter.siamese.dyndns.org>

On Fri, Jan 20, 2012 at 11:18:50AM -0800, Junio C Hamano wrote:
> David Brown <davidb@codeaurora.org> writes:
> 
> > On Fri, Jan 20, 2012 at 03:13:58PM +0100, Andreas Schwab wrote:
> >> Brian Foster <brian.foster@maxim-ic.com> writes:
> >> 
> >> >  In a script, how can I determine commit Y is reachable
> >> >  from the current HEAD ?
> >> 
> >> test $(git merge-base HEAD Y) = $(git rev-parse Y)
> >
> > Almost.  It works as long as there is only one merge base.  You really
> > need to check if $(git rev-parse Y) is one of $(git merge-base --all
> > HEAD Y)
> 
> Can you give us an example of a topology to which "merge-base --all HEAD Y"
> gives more than one output and Y is still reachable from HEAD?
> 
> It is my understanding that merge-base computation will give only Y and
> nothing else when Y is reachable from HEAD. I also think this assumption
> is used by some of the internal code in Git, and that is why I care.

Hmm, I thought I'd convinced myself that this was possible.  Now, I
can't come up with a way of doing it that doesn't involve improper
commits with earlier timestamps than their parents.

Sorry about that,
David

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

  reply	other threads:[~2012-01-20 23:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-20 13:33 [Q] Determing if a commit is reachable from the HEAD ? Brian Foster
2012-01-20 14:13 ` Andreas Schwab
2012-01-20 18:06   ` David Brown
2012-01-20 19:18     ` Junio C Hamano
2012-01-20 23:33       ` David Brown [this message]
2012-01-21  0:04         ` Junio C Hamano
2012-01-21  4:58           ` David Brown
2012-01-20 22:50 ` Sitaram Chamarty
2012-01-23  9:20   ` Brian Foster
2012-01-23 16:09     ` Junio C Hamano
2012-01-24  8:16       ` Brian Foster
2012-01-24  8:56       ` Brian Foster

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=20120120233335.GA20302@codeaurora.org \
    --to=davidb@codeaurora.org \
    --cc=brian.foster@maxim-ic.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=schwab@linux-m68k.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.