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

Re: [PATCH v2 2/2] [GSOC] ref-filter: add %(raw) atom

From
Christian Couder <christian.couder@gmail.com>
Date
Jun 4, 2021, 13:23 UTC
Message-ID
<CAP8UFD3m-=4=a9XX6Nu45+-4QdeNYi54rXgqizR7HrOh_qk8OQ@mail.gmail.com>
In-Reply-To
<0efed9435b59098f3ad928acd46c3c7e9f13677d.1622808751.git.gitgitgadget@gmail.com>

On Fri, Jun 4, 2021 at 2:12 PM ZheNing Hu via GitGitGadget <gitgitgadget@gmail.com> wrote:

Show 9 quoted lines
>
> From: ZheNing Hu <adlternative@gmail.com>
>
> Add new formatting option `%(raw)`, which will print the raw
> object data without any changes. It will help further to migrate
> all cat-file formatting logic from cat-file to ref-filter.
>
> The raw data of blob, tree objects may contain '\0', but most of
> the logic in `ref-filter` depands on the output of the atom being
s/depands/depends/
> text (specifically, no embedded NULs in it).
Show 9 quoted lines
> diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt
> index 2ae2478de706..8f8d8cd1e04f 100644
> --- a/Documentation/git-for-each-ref.txt
> +++ b/Documentation/git-for-each-ref.txt
> @@ -235,6 +235,15 @@ and `date` to extract the named component.  For email fields (`authoremail`,
>  without angle brackets, and `:localpart` to get the part before the `@` symbol
>  out of the trimmed email.
>
> +The raw data in a object is `raw`.
s/a object/an object/
Show 7 quoted lines
> +
> +raw:size::
> +       The raw data size of the object.
> +
> +Note that `--format=%(raw)` can not be used with `--python`, `--shell`, `--tcl`,
> +`--perl` because the host language may not support arbitrary binary data in the
> +variables of its string type.
Show 6 quoted lines
> @@ -1765,7 +1815,7 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
>                 int deref = 0;
>                 const char *refname;
>                 struct branch *branch = NULL;
> -
> +               v->s_size = ATOM_VALUE_S_SIZE_INIT;
It looks like a blank line was removed as you added the above new line.
>                 v->handler = append_atom;
>                 v->atom = atom;
>
Previous: ZheNing Hu via GitGitGadgetNext: Christian Couder
Message 17 of 23 in “[GSOC] ref-filter: add %(raw) atom”
  1. 0/2 [GSOC] ref-filter: add %(raw) atomZheNing Hu via GitGitGadget, Jun 1, 2021
  2. 1/2 [GSOC] ref-filter: add obj-type check in grab contentsZheNing Hu via GitGitGadget, Jun 1, 2021
  3. Junio C HamanoJun 3, 2021
  4. ZheNing HuJun 3, 2021
  5. 2/2 [GSOC] ref-filter: add %(raw) atomZheNing Hu via GitGitGadget, Jun 1, 2021
  6. Junio C HamanoJun 3, 2021
  7. ZheNing HuJun 3, 2021
  8. ZheNing HuJun 3, 2021
  9. Junio C HamanoJun 3, 2021
  10. Junio C HamanoJun 3, 2021
  11. ZheNing HuJun 4, 2021
  12. Bagas SanjayaJun 3, 2021
  13. ZheNing HuJun 3, 2021
  14. 0/2 [GSOC] ref-filter: add %(raw) atomZheNing Hu via GitGitGadget, Jun 4, 2021
  15. 1/2 [GSOC] ref-filter: add obj-type check in grab contentsZheNing Hu via GitGitGadget, Jun 4, 2021
  16. 2/2 [GSOC] ref-filter: add %(raw) atomZheNing Hu via GitGitGadget, Jun 4, 2021
  17. Christian CouderJun 4, 2021
  18. Christian CouderJun 4, 2021
  19. ZheNing HuJun 5, 2021
  20. Christian CouderJun 5, 2021
  21. ZheNing HuJun 5, 2021
  22. Christian CouderJun 5, 2021
  23. ZheNing HuJun 5, 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.