repo: add the flag -z as an alias for --format=nul

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 <karthik.188@gmail.com>
Mentored-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Lucas Seiki Oshiro
2025-09-04 10:40:16 -03:00
committed by Junio C Hamano
parent c8f660a7ca
commit a92f5ca0d5
3 changed files with 42 additions and 14 deletions

View File

@@ -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>...]
DESCRIPTION
-----------
@@ -18,7 +18,7 @@ THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE.
COMMANDS
--------
`info [--format=(keyvalue|nul)] [<key>...]`::
`info [--format=(keyvalue|nul)] [-z] [<key>...]`::
Retrieve metadata-related information about the current repository. Only
the requested data will be returned based on their keys (see "INFO KEYS"
section below).
@@ -40,6 +40,8 @@ supported:
between the key and the value and using a NUL character after each value.
This format is better suited for being parsed by another applications than
`keyvalue`. Unlike in the `keyvalue` format, the values are never quoted.
+
`-z` is an alias for `--format=nul`.
INFO KEYS
---------