From: Michael Haggerty <mhagger@alum.mit.edu>
To: Junio C Hamano <gitster@pobox.com>
Cc: Ian Jackson <ijackson@chiark.greenend.org.uk>, git@vger.kernel.org
Subject: Re: [PATCH 0/5] git check-ref-format --stdin --report-errors
Date: Tue, 20 Dec 2016 08:29:31 +0100 [thread overview]
Message-ID: <21317fc7-c1fb-8be0-eadf-90fed9486a48@alum.mit.edu> (raw)
In-Reply-To: <xmqqlgvbpyku.fsf@gitster.mtv.corp.google.com>
On 12/19/2016 07:23 PM, Junio C Hamano wrote:
> Michael Haggerty <mhagger@alum.mit.edu> writes:
>
>> Especially given that the output is not especially machine-readable, it
>> might be more consistent with other commands to call the new feature
>> `--verbose` rather than `--report-errors`.
>
> Don't we instead want to structure the output to be machine-readable
> instead, given that check-ref-format is a very low level plumbing
> command that is primarily meant for scriptors?
Of course that would be the ideal. Let's think about what it would look
like. Given that the very purpose of the program is to decide whether
its inputs are reasonable reference names or not, it would be important
to make it bulletproof:
* It could be fed some ugly garbage
* It could be used for security-relevant checks
One obvious choice would be to use NUL separators, but that would make
the output mostly unreadable to humans.
Another would be to use LF to terminate each line of output, like
ok TAB refs/heads/foo LF
bad TAB refs/heads/bad SP name@@.lock LF
For the LF-terminated `--stdin` input, this should be unambiguous.
However, it wouldn't necessarily work for arguments passed in via the
command line, for for slight variations on `--stdin` like if we were to
add a `-z` option to allow the input to be NUL-terminated.
The 100% solution would probably be to support language-specific
quoting, like the `--shell`/`--perl`/`--python`/`--tcl` options accepted
by `for-each-ref`, probably with a fifth option for NUL-terminated
output. And it should probably also support a `-z` option to make its
input NUL-separated. Pretty much all of the infrastructure is already
there in `quote.h` and `quote.c`, and the option-parsing could be
cribbed from `builtin/for-each-ref.c`, so it wouldn't even be *that*
much work to implement.
Michael
prev parent reply other threads:[~2016-12-20 7:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-04 19:13 [PATCH 0/5] git check-ref-format --stdin --report-errors Ian Jackson
2016-11-04 19:13 ` [PATCH 1/5] check-ref-format: Refactor out check_one_ref_format Ian Jackson
2016-12-19 8:27 ` Michael Haggerty
2016-12-19 13:19 ` Ian Jackson
2016-12-20 6:57 ` Michael Haggerty
2016-11-04 19:13 ` [PATCH 2/5] check-ref-format: Refactor to make --branch code more common Ian Jackson
2016-12-19 11:07 ` Michael Haggerty
2016-12-19 11:54 ` Ian Jackson
2016-11-04 19:13 ` [PATCH 3/5] check-ref-format: Abolish leak of collapsed refname Ian Jackson
2016-12-19 11:09 ` Michael Haggerty
2016-11-04 19:13 ` [PATCH 4/5] check-ref-format: New --report-errors option Ian Jackson
2016-11-04 19:13 ` [PATCH 5/5] check-ref-format: New --stdin option Ian Jackson
2016-12-19 11:22 ` Michael Haggerty
2016-12-19 13:43 ` Michael Haggerty
2016-12-19 11:29 ` [PATCH 0/5] git check-ref-format --stdin --report-errors Michael Haggerty
2016-12-19 16:22 ` Ian Jackson
2016-12-19 18:23 ` Junio C Hamano
2016-12-20 7:29 ` Michael Haggerty [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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=21317fc7-c1fb-8be0-eadf-90fed9486a48@alum.mit.edu \
--to=mhagger@alum.mit.edu \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ijackson@chiark.greenend.org.uk \
/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.
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 NNTP newsgroup(s).