From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>,
git@vger.kernel.org, jltobler@gmail.com
Subject: Re: [PATCH] repo: add -z as an alias for --format=nul to git-repo-structure
Date: Mon, 1 Dec 2025 09:28:47 +0100 [thread overview]
Message-ID: <aS1Rvy9J2KjWrQb4@pks.im> (raw)
In-Reply-To: <xmqqms43aqn2.fsf@gitster.g>
On Sun, Nov 30, 2025 at 06:21:21PM -0800, Junio C Hamano wrote:
> Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> writes:
>
> > -git repo structure [--format=(table|keyvalue|nul)]
> > +git repo structure [--format=(table|keyvalue|nul)] [-z]
>
> It's a minor thing but I wonder if this should be more like
>
> git repo structure [--format=(table|keyvalue|nul) | -z]
This discussion rings a bell -- didn't we already discuss this for `git
repo info`? Yup, indeed [1]. Initial versions of `git repo info `-z`
also had it formatted like the above, but the discussion eventually led
to a version that is the same as the one proposed in this patch here.
I think this ultimately stems from [2], where you argue that it _is_
possible to say `git repo info --format=table -z`, and the last option
wins. It's the same for `git repo structure`, so I'd argue we should be
consistent.
[1]: <20250820144247.79197-1-lucasseikioshiro@gmail.com>
[2]: <xmqqcy8frqn2.fsf@gitster.g>
> > diff --git a/t/t1901-repo-structure.sh b/t/t1901-repo-structure.sh
> > index 36a71a144e..5a50acf345 100755
> > --- a/t/t1901-repo-structure.sh
> > +++ b/t/t1901-repo-structure.sh
> > @@ -101,6 +101,12 @@ test_expect_success 'keyvalue and nul format' '
> > tr "\n=" "\0\n" <expect >expect_nul &&
> > git repo structure --format=nul >out 2>err &&
> >
> > + test_cmp expect_nul out &&
> > + test_line_count = 0 err &&
> > +
> > + # Check -z
> > + git repo structure --format=nul >out 2>err &&
>
> Didn't you want to check "-z", not "--format=nul"? In addition,
> perhaps test
>
> # "-z", as a synonym to "--format=nul", participates in the
> # usual "last one wins" rule.
> git repo structure --format=table -z >out 2>err &&
>
> as well, or is it too obvious (by knowing how parse-options API is
> used) that it is pointless to test?
I think it wouldn't be pointless given the above -- we should verify
that the last one wins, regardless of whether you use the alias or the
long option.
Patrick
next prev parent reply other threads:[~2025-12-01 8:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-30 19:59 [PATCH] repo: add -z as an alias for --format=nul to git-repo-structure Lucas Seiki Oshiro
2025-12-01 2:21 ` Junio C Hamano
2025-12-01 8:28 ` Patrick Steinhardt [this message]
2025-12-01 14:34 ` Lucas Seiki Oshiro
2025-12-02 3:45 ` Junio C Hamano
2025-12-02 22:05 ` Lucas Seiki Oshiro
2025-12-01 15:11 ` Justin Tobler
2025-12-02 0:29 ` Lucas Seiki Oshiro
2025-12-04 20:10 ` [PATCH v2 0/3] " Lucas Seiki Oshiro
2025-12-04 20:10 ` [PATCH v2 1/3] repo: remove blank line from Documentation/git-repo.adoc Lucas Seiki Oshiro
2025-12-04 20:10 ` [PATCH v2 2/3] repo: use [--format=... | -z] instead of [-z] in git-repo-info synopsis Lucas Seiki Oshiro
2025-12-04 20:10 ` [PATCH v2 3/3] repo: add -z as an alias for --format=nul to git-repo-structure Lucas Seiki Oshiro
2025-12-11 5:23 ` Junio C Hamano
2025-12-18 23:02 ` Lucas Seiki Oshiro
2025-12-05 11:09 ` [PATCH v2 0/3] " Patrick Steinhardt
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=aS1Rvy9J2KjWrQb4@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jltobler@gmail.com \
--cc=lucasseikioshiro@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.
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).