From: Phillip Wood Date: Fri, 02 Oct 2026 14:11:31 GMT Subject: Re: [PATCH v9 0/4] var: -z output, multiple variables, and broken-out idents Message-ID: <33f24834-8e73-4230-bf0a-6809a85d9a86@gmail.com> In-Reply-To: <20260926162048.30853-1-andrewpleeter@gmail.com> Hi Andrew On 26/09/2026 17:20, Andrew Pleeter wrote: > This is a reroll of the single patch in v8, split up as Junio asked > for, with the changes Phillip asked for on the list. > > v8 was one commit doing four things at once. It is now four patches: > > 1/4 converts the internal representation of a multi-valued variable > from a newline-joined string to a string_list, with no change in > output. Phillip suggested doing this as its own preparatory step. > > 2/4 adds "-z", which is what forces the switch to parse_options(), so > that conversion lives here rather than in 1/4. > > 3/4 teaches "git var" to take more than one variable. > > 4/4 adds GIT_AUTHOR_NAME and friends. These patches look good to me. I've left a comment on the tests in patches 3 and 4, but I'm not sure they are enough to warrant a re-roll. Thanks for working on this, supporting multiple values and NUL termination are really useful improvements. Phillip > Changes since v8: > > * GIT_SIGNING_KEY is dropped. Phillip asked three times how it was > meant to be used, and once I looked properly the answer was that the > value cannot be interpreted without also reading gpg.format, and that > in the default configuration it is a committer ident rather than a > key at all. I would rather leave it out than define a variable I > cannot describe. Details are in my reply to him on this thread. > > * Asking for several variables no longer exits non-zero just because > one of them has no value; such a variable is left out of the output > and the rest are still shown. A non-zero status is now reserved for > real errors, such as naming a variable that does not exist, so > callers can detect those from the exit code. A single variable still > exits 1 when it has no value, as before. This is Phillip's > GIT_CONFIG_NOSYSTEM point. > > * GIT_CONFIG_GLOBAL is documented as a variable that can have more than > one value. > > * The commit messages are prose rather than a list of bullet points, > and no longer narrate how the patch was developed. > > The tests use nul_to_q rather than running test_cmp over files > containing NUL bytes, which Phillip pointed out in v6. Each patch builds > and passes t0007 on its own. > > One thing I did not do, and would like an opinion on: for a multi-valued > variable in multi-variable mode, rather than emitting a trailing > delimiter, each value is shown as its own "VARIABLE=value" entry, which > matches "git var -l". Phillip suggested the trailing delimiter and I am > happy to switch. > > Andrew Pleeter (4): > var: represent multi-valued variables with a string_list > var: add "-z" output mode > var: accept more than one variable > var: add broken-out identity variables > > Documentation/git-var.adoc | 68 +++++++++-- > builtin/var.c | 242 +++++++++++++++++++++++++++++-------- > t/t0007-git-var.sh | 153 +++++++++++++++++++++++ > 3 files changed, 403 insertions(+), 60 deletions(-) >