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

Re: [PATCH] repo: add -z as an alias for --format=nul to git-repo-structure

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 2, 2025, 03:45 UTC
Message-ID
<xmqqsedt8s3g.fsf@gitster.g>
In-Reply-To
<aS1Rvy9J2KjWrQb4@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
> 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.

I do not think so; [2] was about the explicit "--format=nul and -z are incompatible" code. Even without this '-z" thing, if you have

    [--opt=(a|b|c)]

I _think_ our intention is to allow "git cmd --opt=a --opt=b" from the user and let the last one win. If you add "-z",

    [--format=(table|keyvalue|nul)] [-z]
    [--format=(table|keyvalue|nul) | -z]

I think both would mean the same thing; I just was wonering if grouping them together in one bracket makes it more obvious that these are all options to control the output format.

There was also an inquiry about writing it like
    [(--format=(table|keyvalue|nul) | -z)]
or even
    [(--format=(table|keyvalue|nul) | -z)...]

as these can be repeated and let the last-one-wins rule decide the final outcome, but we do not do that. I thought the final comment on this was in

https://lore.kernel.org/git/6186055.lOV4Wx5bFT@cayenne/
where the message said
    In fact the correct formatting is:
    [--format=(keyvalue|nul) | -z] [<key>...]
    As stated in "CodingGuidelines:
     Use spacing around "|" token(s), but not immediately after opening or
     before closing a [] or () pair:
       Do: [-q | --quiet]
       Don't: [-q|--quiet]
     Don't use spacing around "|" tokens when they're used to separate the
     alternate arguments of an option:
        Do: --track[=(direct|inherit)]
        Don't: --track[=(direct | inherit)]
and that was where the thread ended, I think.
> [1]: <20250820144247.79197-1-lucasseikioshiro@gmail.com>
> [2]: <xmqqcy8frqn2.fsf@gitster.g>
Previous: Lucas Seiki OshiroNext: Lucas Seiki Oshiro
Message 5 of 15 in “repo: add -z as an alias for --format=nul to git-repo-structure”
  1. repo: add -z as an alias for --format=nul to git-repo-structureLucas Seiki Oshiro, Nov 30, 2025
  2. Junio C HamanoDec 1, 2025
  3. Patrick SteinhardtDec 1, 2025
  4. Lucas Seiki OshiroDec 1, 2025
  5. Junio C HamanoDec 2, 2025
  6. Lucas Seiki OshiroDec 2, 2025
  7. Justin ToblerDec 1, 2025
  8. Lucas Seiki OshiroDec 2, 2025
  9. 0/3 repo: add -z as an alias for --format=nul to git-repo-structureLucas Seiki Oshiro, Dec 4, 2025
  10. 1/3 repo: remove blank line from Documentation/git-repo.adocLucas Seiki Oshiro, Dec 4, 2025
  11. 2/3 repo: use [--format=... | -z] instead of [-z] in git-repo-info synopsisLucas Seiki Oshiro, Dec 4, 2025
  12. 3/3 repo: add -z as an alias for --format=nul to git-repo-structureLucas Seiki Oshiro, Dec 4, 2025
  13. Junio C HamanoDec 11, 2025
  14. Lucas Seiki OshiroDec 18, 2025
  15. Patrick SteinhardtDec 5, 2025

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.