git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: ZheNing Hu <adlternative@gmail.com>
To: Christian Couder <christian.couder@gmail.com>
Cc: ZheNing Hu via GitGitGadget <gitgitgadget@gmail.com>,
	git <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>,
	Hariom Verma <hariom18599@gmail.com>
Subject: Re: [PATCH] [GSOC] ref-filter: add contents:raw atom
Date: Fri, 21 May 2021 21:39:30 +0800	[thread overview]
Message-ID: <CAOLTT8TVn-SPdsX+0BrrrWzhq3in6DDFxDY_i4fEhkd-dW6nqg@mail.gmail.com> (raw)
In-Reply-To: <CAOLTT8Q9meKiHG=TvwsW49dwWtzBNnkfT03+dQrvKDLGuLiOFg@mail.gmail.com>

ZheNing Hu <adlternative@gmail.com> 于2021年5月21日周五 下午9:12写道:
>
>
> 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

      reply	other threads:[~2021-05-21 13:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20  8:49 [PATCH] [GSOC] ref-filter: add contents:raw atom ZheNing Hu via GitGitGadget
2021-05-20 11:29 ` Hariom verma
2021-05-20 14:34   ` ZheNing Hu
2021-05-20 16:20 ` Christian Couder
2021-05-21  4:43   ` ZheNing Hu
2021-05-21  9:10     ` Christian Couder
2021-05-21 13:12       ` ZheNing Hu
2021-05-21 13:39         ` ZheNing Hu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOLTT8TVn-SPdsX+0BrrrWzhq3in6DDFxDY_i4fEhkd-dW6nqg@mail.gmail.com \
    --to=adlternative@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=hariom18599@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).