Re: [Q] Determing if a commit is reachable from the HEAD ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Brown <davidb@xxxxxxxxxxxxxx> writes:

> On Fri, Jan 20, 2012 at 03:13:58PM +0100, Andreas Schwab wrote:
>> Brian Foster <brian.foster@xxxxxxxxxxxx> 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.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]