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

Re: [PATCH] [GSOC] ref-filter: add contents:raw atom

From
ZheNing Hu <adlternative@gmail.com>
Date
May 21, 2021, 13:39 UTC
Message-ID
<CAOLTT8TVn-SPdsX+0BrrrWzhq3in6DDFxDY_i4fEhkd-dW6nqg@mail.gmail.com>
In-Reply-To
<CAOLTT8Q9meKiHG=TvwsW49dwWtzBNnkfT03+dQrvKDLGuLiOFg@mail.gmail.com>
ZheNing Hu <adlternative@gmail.com> 于2021年5月21日周五 下午9:12写道:
Show 26 quoted lines
>
>
> Now we want to use for-each-ref to print a ref point to a tree:
>
> git for-each-ref --format="%(contents:raw)" refs/mytrees/first
>
> will output:
>
> 100644 one
>
> but
>
> git cat-file tree refs/mytrees/first
>
> will output:
>
> 100644 onem�cֈ��q�D�֧hJ)E-100644 two.t���0�+��VjC��eV�ӈq
>
> which is the compressed data, it may contains '\0'.
>
> Whne we use `append_atom()` to add the contents of the tree object
> to the buffer, notice that it uses `strbuf_addstr()`, the underlying call
> is `strlen()`, which truncates the data we added. Can we have any good
> remedies? For example, record the length of "v->s" by "v->s_size" and
> use `strbuf_addstr(&state->stack->output, v->s, v->s_size)`?
>

This is not a good method, because `quote_formatting()` in `append_atom()` will also cause this truncation problem.

-- ZheNing Hu

Previous: ZheNing Hu
Message 8 of 8 in “[GSOC] ref-filter: add contents:raw atom”
  1. [GSOC] ref-filter: add contents:raw atomZheNing Hu via GitGitGadget, May 20, 2021
  2. Hariom vermaMay 20, 2021
  3. ZheNing HuMay 20, 2021
  4. Christian CouderMay 20, 2021
  5. ZheNing HuMay 21, 2021
  6. Christian CouderMay 21, 2021
  7. ZheNing HuMay 21, 2021
  8. ZheNing HuMay 21, 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.