From: Junio C Hamano <gitster@pobox.com>
To: "Andrew Pleeter via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org,
"brian m. carlson" <sandals@crustytoothpaste.net>,
Jeff King <peff@peff.net>, Ben Knoble <ben.knoble@gmail.com>,
Phillip Wood <phillip.wood123@gmail.com>,
Andrew Pleeter <andrewpleeter@gmail.com>
Subject: Re: [PATCH v8] var: support broken-down idents, signing key, multiple args, and -z
Date: Tue, 15 Sep 2026 10:21:51 -0700 [thread overview]
Message-ID: <xmqq33va1lcg.fsf@gitster.g> (raw)
In-Reply-To: <pull.2388.v8.git.git.1789426226860.gitgitgadget@gmail.com> (Andrew Pleeter via GitGitGadget's message of "Mon, 14 Sep 2026 22:50:26 +0000")
"Andrew Pleeter via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Andrew Pleeter <andrewpleeter@gmail.com>
>
> While 'git var' exposes GIT_AUTHOR_IDENT and GIT_COMMITTER_IDENT,
> extracting individual components (name, email, or date) currently
> requires callers to manually parse the composite string. Furthermore,
> there is no way to query the resolved commit signing key through
> 'git var', and the command only accepts a single variable at a time.
>
> Teach 'git var' to expose individual identity components and commit
> signing configuration, and allow querying multiple variables with
> optional NUL-termination:
The huge laundary list (below) strongly tells us that this single
patch is doing too many things at once and it is better done as a
multi-patch series. Also, some descriptions seem to hint how the
implementation evolved during the development of this patch, which
nobody is interested when they read "git log" output (which is the
ultimate target audience we write our commit log messages for).
I would say this should be split into at least 3 patches.
(1) Add "-z" output mode.
To allow reading scripts to unambiguously parse output from
"git var (-l | <var>)" command, implement a NUL terminated
output mode, similar to how "git config -l -z" shows list of
configuration variables and their values. When showing the
value of a single variable this only makes difference for
variable with multiple values, but in the next step in this
series, we will introduce a mode where multiple variables are
queried.
(2) Add (2 <= argc) mode that displays like "var -l" mode on top.
To allow reading values for multiple variables with a single
command invocation, teach "var" to take more than one variable,
and show output the same way as "git var -l [-z]", giving list
of "var=value" but only for variables requested by the user.
(3) Add new variables.
Scripts reading from "git var GIT_AUTHOR_IDENT" needs to parse
the output if they want to extract only the author name.
To allow scripts to easily access broken-out fields of
GIT_{AUTHOR,COMMITTER}_IDENT, add a GIT_AUTHOR_NAME variable
and its friends, as well as GIT_SIGNING_KEY.
After you receive a review, you should respond and try to engage in
a dialog with reviewers, before sending a new iteration of a patch.
When your new iteration is different from what reviewer suggested,
without such an exchange beforehand, reviewers cannot tell if that
is merely due to miscommunication, or you had a good reason to do
things differently. Don't make reviewers feel as if they are
talking to silent machine that takes an earlier iteration of the
patch with their input and spits out a new iteration.
Thanks.
> - Add GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, and GIT_AUTHOR_DATE.
> - Add GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL, and GIT_COMMITTER_DATE.
> - Add GIT_SIGNING_KEY to resolve the key that would be used to sign
> the resulting commit if you were to run 'git commit' right now.
> - Allow passing multiple variable arguments (e.g., 'git var
> GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL').
> - When a single variable is requested, print its bare value for backward
> compatibility.
> - When multiple variables are requested, model the output after
> 'git var -l' by printing 'VARIABLE=value' pairs (or 'VARIABLE\nvalue\0'
> when '-z' is given).
> - Format multi-valued variables in multi-variable mode as repeated
> 'VARIABLE=value' entries (or 'VARIABLE\nvalue\0' with '-z'),
> eliminating stream ambiguity without extra trailing delimiters.
> - When querying multiple variables, omit any variable that has no value,
> continue processing remaining variables, and exit with code 1.
> - Support '-z' to terminate variable outputs with NUL bytes.
> - Format 'git var -l -z' using the same convention as 'git config
> list -z' (newline separating key and value, NUL separating entries).
> - Use parse_options() to strictly require options before arguments.
> - Update Documentation/git-var.adoc and t/t0007-git-var.sh.
next prev parent reply other threads:[~2026-09-15 17:21 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 20:46 [PATCH] builtin/whoami: add new 'whoami' command Andrew Pleeter via GitGitGadget
2026-08-25 21:24 ` brian m. carlson
2026-08-25 21:41 ` Junio C Hamano
2026-08-31 23:59 ` [PATCH v2] builtin/ident: add new 'ident' command Andrew Pleeter via GitGitGadget
2026-09-01 4:39 ` Jeff King
2026-09-01 5:00 ` Junio C Hamano
2026-09-03 2:49 ` [PATCH v3] var: support broken-down idents, default key, multiple args, and -z Andrew Pleeter via GitGitGadget
2026-09-03 17:40 ` Junio C Hamano
2026-09-03 18:22 ` Ben Knoble
2026-09-04 9:11 ` Phillip Wood
2026-09-04 15:57 ` Junio C Hamano
2026-09-08 9:07 ` Phillip Wood
2026-09-08 4:09 ` [PATCH v4] var: support broken-down idents, signing " Andrew Pleeter via GitGitGadget
2026-09-08 13:54 ` Phillip Wood
2026-09-08 20:43 ` [PATCH v5] " Andrew Pleeter via GitGitGadget
2026-09-08 21:53 ` Junio C Hamano
2026-09-09 1:24 ` [PATCH v6] " Andrew Pleeter via GitGitGadget
2026-09-09 15:36 ` Phillip Wood
2026-09-09 16:42 ` Junio C Hamano
2026-09-10 3:09 ` [PATCH v7] " Andrew Pleeter via GitGitGadget
2026-09-14 19:34 ` Junio C Hamano
2026-09-14 22:50 ` [PATCH v8] " Andrew Pleeter via GitGitGadget
2026-09-15 17:21 ` Junio C Hamano [this message]
2026-09-15 22:02 ` Andrew Pleeter
2026-09-22 14:57 ` Phillip Wood
2026-09-26 16:19 ` Andrew Pleeter
2026-09-26 16:20 ` [PATCH v9 0/4] var: -z output, multiple variables, and broken-out idents Andrew Pleeter
2026-10-02 14:11 ` Phillip Wood
2026-10-02 17:41 ` Andrew Pleeter
2026-09-26 16:20 ` [PATCH v9 1/4] var: represent multi-valued variables with a string_list Andrew Pleeter
2026-09-26 16:20 ` [PATCH v9 2/4] var: add "-z" output mode Andrew Pleeter
2026-09-26 16:20 ` [PATCH v9 3/4] var: accept more than one variable Andrew Pleeter
2026-10-02 14:11 ` Phillip Wood
2026-09-26 16:20 ` [PATCH v9 4/4] var: add broken-out identity variables Andrew Pleeter
2026-10-02 14:11 ` Phillip Wood
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=xmqq33va1lcg.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=andrewpleeter@gmail.com \
--cc=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=peff@peff.net \
--cc=phillip.wood123@gmail.com \
--cc=sandals@crustytoothpaste.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.