Plumbing version of 'git branch --contains' ?

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

 



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  
--
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]