Re: What is an efficient way to get all blobs / trees that have notes attached?

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

 



On Fri, Apr 1, 2016 at 2:16 PM, Johan Herland <johan@xxxxxxxxxxx> wrote:
> for notes_ref in $(git for-each-ref refs/notes | cut -c 49-)
> do
>     echo "--- $notes_ref ---"
>     for annotated_obj in $(git notes --ref=$notes_ref list | cut -c 41-)
>     do
>         type=$(git cat-file -t "$annotated_obj")
>         if test "$type" != "commit"
>         then
>             echo "$annotated_obj: $type"
>         fi
>     done
> done
>
> Can probably be made even faster by using the --batch option to cat-file...

For example:

for notes_ref in $(git for-each-ref refs/notes | cut -c 49-)
do
    echo "--- $notes_ref ---"
    git notes --ref=$notes_ref list | cut -c 42- | git cat-file
--batch-check="%(objecttype) %(objectname)" | grep
'^\(\(blob\)\|\(tree\)\) '
done


...Johan

-- 
Johan Herland, <johan@xxxxxxxxxxx>
www.herland.net
--
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]