From: ZheNing Hu <adlternative@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: ZheNing Hu via GitGitGadget <gitgitgadget@gmail.com>,
Git List <git@vger.kernel.org>,
Christian Couder <christian.couder@gmail.com>,
Hariom Verma <hariom18599@gmail.com>,
Karthik Nayak <karthik.188@gmail.com>,
Felipe Contreras <felipe.contreras@gmail.com>,
Bagas Sanjaya <bagasdotme@gmail.com>, Jeff King <peff@peff.net>,
Phillip Wood <phillip.wood123@gmail.com>
Subject: Re: [PATCH v2 2/2] [GSOC] ref-filter: add %(raw) atom
Date: Mon, 31 May 2021 22:35:28 +0800 [thread overview]
Message-ID: <CAOLTT8REM7tF6ojdmnsJt7-RE6a8oX4RFXVcL215YnYTx6b62w@mail.gmail.com> (raw)
In-Reply-To: <xmqqh7ij20l8.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> 于2021年5月31日周一 上午8:44写道:
>
> "ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > Beyond, `--format=%(raw)` cannot be used with `--python`, `--shell`,
> > `--tcl`, `--perl` because if our binary raw data is passed to a variable
> > in the host language, the host languages may cause escape errors.
>
> "may cause escape errors" just says you are not escaping correctly
> in your code (implying that this patch is not good enough and with
> more effort we should be able to fix it to allow binaries), but the
> problem is the host languages may not support binaries
> (specifically, anything with a NUL in it) at all, which is
> fundamentally unfixable, in which case, rejecting is the only
> sensible choice.
>
> ... because the host language may not support a NUL in the variables
> of its string type.
>
I agree. But host language not only support NUL but also some Non-ASCII
character and Non-UTF-8 code:
$ git hash-object a.out -w | xargs git update-ref refs/myblobs/aoutblob
$ git for-each-ref --format="name=%(raw)" refs/myblobs/aoutblob
--python | python2
File "<stdin>", line 1
SyntaxError: Non-ASCII character '\x8b' in file <stdin> on line 2, but
no encoding declared;
see http://python.org/dev/peps/pep-0263/ for details
$ git for-each-ref --format="name=%(raw)" refs/myblobs/aoutblob
--python |python3
SyntaxError: Non-UTF-8 code starting with '\x8b' in file <stdin> on
line 2, but no encoding declared;
see http://python.org/dev/peps/pep-0263/ for details
> > +The raw data in a object is `raw`, For commit and tag objects, `raw` contain
>
> s/contain/contains/, but more importantly, as we are not introducing
> %(header), I do not see why we want to talk about its details. For
> commits and tags, just like for trees and blobs, 'raw' is the raw
> data in the object, so beyond "The raw data of a object is %(raw)",
> I do not think there is anything to talk about.
>
Ok, I will delete this part.
> > + const char *s = buf->buf;
> > + size_t cur_len = 0;
> > +
> > + while ((cur_len != buf->len) && (isspace(*s) || *s == '\0')) {
> > s++;
> > + cur_len++;
>
> Is NUL treated the same as a whitespace letter for the purpose of
> determining if a line is empty? WHY?
>
Well, there seems to be no correction here. But is it true that memory
like "\0abc" is considered empty?
Thanks.
--
ZheNing Hu
next prev parent reply other threads:[~2021-05-31 15:54 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-27 14:43 [PATCH 0/2] [GSOC] ref-filter: add %(raw) atom ZheNing Hu via GitGitGadget
2021-05-27 14:43 ` [PATCH 1/2] " ZheNing Hu via GitGitGadget
2021-05-27 16:36 ` Felipe Contreras
2021-05-28 13:02 ` ZheNing Hu
2021-05-28 16:30 ` Felipe Contreras
2021-05-30 5:37 ` ZheNing Hu
2021-05-29 13:23 ` Phillip Wood
2021-05-29 15:24 ` Felipe Contreras
2021-05-29 17:23 ` Phillip Wood
2021-05-30 6:29 ` ZheNing Hu
2021-05-30 13:05 ` Phillip Wood
2021-05-31 14:15 ` ZheNing Hu
2021-05-31 15:35 ` Felipe Contreras
2021-05-30 6:26 ` ZheNing Hu
2021-05-30 13:02 ` Phillip Wood
2021-05-28 3:03 ` Junio C Hamano
2021-05-28 15:04 ` ZheNing Hu
2021-05-28 16:38 ` Felipe Contreras
2021-05-30 8:11 ` ZheNing Hu
2021-05-27 14:43 ` [PATCH 2/2] [GSOC] ref-filter: add %(header) atom ZheNing Hu via GitGitGadget
2021-05-27 16:37 ` Felipe Contreras
2021-05-28 3:06 ` Junio C Hamano
2021-05-28 4:36 ` Junio C Hamano
2021-05-28 15:19 ` ZheNing Hu
2021-05-27 15:39 ` [PATCH 0/2] [GSOC] ref-filter: add %(raw) atom Felipe Contreras
2021-05-30 13:01 ` [PATCH v2 " ZheNing Hu via GitGitGadget
2021-05-30 13:01 ` [PATCH v2 1/2] [GSOC] ref-filter: add obj-type check in grab contents ZheNing Hu via GitGitGadget
2021-05-31 5:34 ` Junio C Hamano
2021-05-30 13:01 ` [PATCH v2 2/2] [GSOC] ref-filter: add %(raw) atom ZheNing Hu via GitGitGadget
2021-05-31 0:44 ` Junio C Hamano
2021-05-31 14:35 ` ZheNing Hu [this message]
2021-06-01 9:54 ` Junio C Hamano
2021-06-01 11:05 ` ZheNing Hu
2021-05-31 4:04 ` Junio C Hamano
2021-05-31 14:40 ` ZheNing Hu
2021-06-01 8:54 ` Junio C Hamano
2021-06-01 11:00 ` ZheNing Hu
2021-06-01 13:48 ` Johannes Schindelin
2021-05-31 4:10 ` Junio C Hamano
2021-05-31 15:41 ` Felipe Contreras
2021-06-01 10:37 ` ZheNing Hu
-- strict thread matches above, loose matches on Subject: below --
2021-06-01 14:37 [PATCH 0/2] " ZheNing Hu via GitGitGadget
2021-06-04 12:12 ` [PATCH v2 " ZheNing Hu via GitGitGadget
2021-06-04 12:12 ` [PATCH v2 2/2] " ZheNing Hu via GitGitGadget
2021-06-04 13:23 ` Christian Couder
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=CAOLTT8REM7tF6ojdmnsJt7-RE6a8oX4RFXVcL215YnYTx6b62w@mail.gmail.com \
--to=adlternative@gmail.com \
--cc=bagasdotme@gmail.com \
--cc=christian.couder@gmail.com \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=hariom18599@gmail.com \
--cc=karthik.188@gmail.com \
--cc=peff@peff.net \
--cc=phillip.wood123@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).