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

Re: [PATCH 2/3] [GSOC] ref-filter: support %(contents) for blob, tree

From
ZheNing Hu <adlternative@gmail.com>
Date
May 25, 2021, 09:28 UTC
Message-ID
<CAOLTT8TaJm=9mQNXMGxt-bME-ynOpv4CKZvZw+yo9zNueH_VPw@mail.gmail.com>
In-Reply-To
<xmqqa6ojgy9h.fsf@gitster.g>
Show 28 quoted lines
>
> To extend on this point a bit (even though this is not all that
> urgent during the prerelease freeze), conceptually, the %(content)
> field is understood in the larger picture like this:
>
> +--- (the whole thing) ----------------------------------------------+
> |                                                                    |
> | +--- "header" ---------------------------------------------------+ |
> | | tree 678c03dca0a26afd746e8c8bb9e4aadc8bf479b1                  | |
> | | parent 378c7c6ad48c4ccddf9b534616a0e86f28440bd3                | |
> | | author Junio C Hamano <gitster@pobox.com> 1621675665 +0900     | |
> | | committer Junio C Hamano <gitster@pobox.com> 1621675741 +0900  | |
> | +----------------------------------------------------------------+ |
> |                                                                    |
> | +--- "contents" -------------------------------------------------+ |
> | |                                                                | |
> | | +--- "subject" ----------------------------------------------+ | |
> | | | Git 2.32-rc1                                               | | |
> | | +------------------------------------------------------------+ | |
> | |                                                                | |
> | | +--- "body" -------------------------------------------------+ | |
> | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>          | | |
> | | +------------------------------------------------------------+ | |
> | |                                                                | |
> | +----------------------------------------------------------------+ |
> |                                                                    |
> +--------------------------------------------------------------------+
>

Thank you for providing such a complete view. This also means that the "raw" of contents and tag will contain two parts: "header" and "contents". But for blobs and trees, they don’t have these things.

Show 5 quoted lines
> Even though %(header), when it is invented, would make perfect sense
> for commits and tags, it will never make sense for trees and blobs.
> Which means "contents", which is "the whole thing except for the
> header part", would not, either.
>

Although we don’t have a %(header), but in fact we already have fragments of "%(numparent)", "%(parent)" %(tree)" (see grab_commit_values()) and "%(tag)"," %(type)","%(object)" (see grab_tag_values()), but they are not obtained through the "header" part of the raw object buffer.

Show 6 quoted lines
> There is no %(placeholder) to ask for "the whole thing", and that is
> what you want to use for cat-file --batch if I am not mistaken, and
> adding one would be a good idea.  There is no %(header) yet, either,
> but if somebody needs it for their scripts, it is clear where it fits
> in the picture.
>
So I don't know if adding %(header) will cause duplication of functions.

Thanks! -- ZheNing Hu

Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 18 in “[GSOC][RFC] ref-filter: add contents:raw atom”
  1. 0/3 [GSOC][RFC] ref-filter: add contents:raw atomZheNing Hu via GitGitGadget, May 23, 2021
  2. 1/3 [GSOC] quote: add *.quote_buf_with_size functionsZheNing Hu via GitGitGadget, May 23, 2021
  3. 2/3 [GSOC] ref-filter: support %(contents) for blob, treeZheNing Hu via GitGitGadget, May 23, 2021
  4. Junio C HamanoMay 25, 2021
  5. Junio C HamanoMay 25, 2021
  6. ZheNing HuMay 25, 2021
  7. Junio C HamanoMay 25, 2021
  8. ZheNing HuMay 26, 2021
  9. 3/3 [GSOC] ref-filter: add contents:raw atomZheNing Hu via GitGitGadget, May 23, 2021
  10. Junio C HamanoMay 24, 2021
  11. Felipe ContrerasMay 24, 2021
  12. Bagas SanjayaMay 24, 2021
  13. Junio C HamanoMay 24, 2021
  14. ZheNing HuMay 24, 2021
  15. Junio C HamanoMay 26, 2021
  16. ZheNing HuMay 26, 2021
  17. Junio C HamanoMay 26, 2021
  18. ZheNing HuMay 26, 2021

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.