Thread (3 messages) 3 messages, 2 authors, 2016-06-15

Re: Determining commit reachability

From: Jeff King <hidden>
Date: 2016-06-15 22:49:29

On Sun, Sep 05, 2010 at 10:34:11PM +0200, Artur Skawina wrote:
Given commit C, refs (branches) R, S and T what would be the best way
to test whether 'C' is reachable from any of the heads?

Checking if `git rev-list -n1 O ^R ^S ^T` produces any output is what
i came up with; is there a better (ie faster) solution?
I think that is about as fast as you will get. You could try something
with git-merge-base, but it should be about the same speed.

Note that neither will tell you _which_ head the target was reachable
from. For that, given the current interface you have to test each head
individually. If you write some C code, you can do it all in a single
traversal. See this thread for some discussion of how "git tag
--contains" can be sped up:

  http://article.gmane.org/gmane.comp.version-control.git/150039

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help