All of lore.kernel.org
 help / color / mirror / Atom feed
* Plumbing version of 'git branch --contains' ?
@ 2014-10-22 20:19 Crabtree, Andrew
  2014-10-23 17:19 ` Jeff King
  0 siblings, 1 reply; 3+ messages in thread
From: Crabtree, Andrew @ 2014-10-22 20:19 UTC (permalink / raw)
  To: git@vger.kernel.org

I need to get a list of refs that can reach a certain SHA in in a script.

git branch --contains SHA 

would be great (runs in ~2 seconds), but not my preferred option for scripting.

I tried
 
for br in $(git for-each-ref --format='%(refname:short)' refs/heads/)
do
    git merge-base --is-ancestor $1 ${br}
    if [ $? -eq 0 ]
    then
            echo "${br}"
    fi
done

Which gives me perfect output, but takes 82 seconds to run in my environment.  

Is there an alternative I'm missing to give me the run time performance of 'git branch --contains' but with stable output suitable for parsing?

Thanks in advance,
-Andrew  

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-10-23 18:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-22 20:19 Plumbing version of 'git branch --contains' ? Crabtree, Andrew
2014-10-23 17:19 ` Jeff King
2014-10-23 18:07   ` Junio C Hamano

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.