Subject: Re: [GSoC PATCH v3 1/2] repo: add the flag -z as an alias for --format=nul

From: Junio C Hamano <[email-masked]>
Date: Tue, 02 Sep 2025 09:21:07 -0700

Lucas Seiki Oshiro <[email-masked]> writes:

> Other Git commands that have nul-terminated output (e.g. git-config,
> git-status, git-ls-files) have a flag `-z` for using the null character
> as the record separator.
>
> Add the `-z` flag to git-repo-info as an alias for `--format=nul`,
> making it consistent with the behavior of the other commands.
>
> Mentored-by: Karthik Nayak <[email-masked]>
> Mentored-by: Patrick Steinhardt <[email-masked]>
> Signed-off-by: Lucas Seiki Oshiro <[email-masked]>
> ---
>  Documentation/git-repo.adoc |  6 ++++--
>  builtin/repo.c              | 37 +++++++++++++++++++++++++------------
>  t/t1900-repo.sh             | 12 ++++++++++++
>  3 files changed, 41 insertions(+), 14 deletions(-)
>
> diff --git a/Documentation/git-repo.adoc b/Documentation/git-repo.adoc
> index 2870828d93..6f5ee88215 100644
> --- a/Documentation/git-repo.adoc
> +++ b/Documentation/git-repo.adoc
> @@ -8,7 +8,7 @@ git-repo - Retrieve information about the repository
>  SYNOPSIS
>  --------
>  [synopsis]
> -git repo info [--format=(keyvalue|nul)] [<key>...]
> +git repo info [--format=(keyvalue|nul)] [-z] [<key>...]

This is OK and I do not want you to reroll only to revert this, but
FWIW what you had in the previous iteration

    git repo info [--format=(keyvalue|nul) | -z] [<key>...]

would also work perfectly well here.  It is not like you are
forbidding the command line to mention "--format=nul" twice, or
"--format=keyvalue --format=nul" to allow the later one to override
the former ones.

The updated option parsing looks much nicer.  Thanks.