git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Johan Herland <johan@herland.net>
Date
Apr 1, 2016, 12:23 UTC
Message-ID
<CALKQrgdONBZOgw5--x35Gq2+2fze=mm1t_162UgC0W12JGg6Hw@mail.gmail.com>
In-Reply-To
<CALKQrgdytYJtMTBHXbcRQ_iT5rWakZCxxqRW1rpLsPiSejud-Q@mail.gmail.com>
On Fri, Apr 1, 2016 at 2:16 PM, Johan Herland <johan@herland.net> wrote:
Show 14 quoted lines
> 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@herland.net>
www.herland.net
Previous: Johan HerlandNext: Sebastian Schuberth
Message 3 of 5 in “What is an efficient way to get all blobs / trees that have notes attached?”
  1. Sebastian SchuberthApr 1, 2016
  2. Johan HerlandApr 1, 2016
  3. Johan HerlandApr 1, 2016
  4. Sebastian SchuberthApr 4, 2016
  5. Johan HerlandApr 4, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.