From: Andrew Pleeter <andrewpleeter@gmail.com>
To: Phillip Wood <phillip.wood@dunelm.org.uk>
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, Ben Knoble <ben.knoble@gmail.com>,
Jeff King <peff@peff.net>,
"brian m. carlson" <sandals@crustytoothpaste.net>
Subject: Re: [PATCH v8] var: support broken-down idents, signing key, multiple args, and -z
Date: Sat, 26 Sep 2026 12:19:51 -0400 [thread overview]
Message-ID: <20260926161951.30531-1-andrewpleeter@gmail.com> (raw)
In-Reply-To: <ddfd5232-b832-476c-8614-268f8e4bbe28@gmail.com>
Hi Phillip,
Sorry for the silence. I was replying on the GitGitGadget PR and did not
realise those comments never reach the list. That is also why v6 switched
to get_signing_key() without a word from me about your question.
You were right to keep asking about GIT_SIGNING_KEY. I am dropping it
from the series. get_signing_key() returns a string whose meaning depends
on gpg.format, and the variable gives the caller no way to tell which
kind it got:
gpg.format=openpgp, user.signingkey unset
$ git var GIT_SIGNING_KEY
C O Mitter <committer@example.com>
gpg.format=openpgp, user.signingkey=DEADBEEF
$ git var GIT_SIGNING_KEY
DEADBEEF
gpg.format=ssh, user.signingkey=/path/to/key.pub
$ git var GIT_SIGNING_KEY
/path/to/key.pub
So no, the key alone does not tell a caller whether to use gpg or ssh;
they would have to read gpg.format as well. And in the default case the
value is a committer ident rather than a key, because that is what
get_signing_key() hands to gpg to look up. Better to drop it than ship a
GIT_SIGNING_KEY that sometimes isn't one. I will revisit it when I can
name a caller it serves.
On the exit code, your GIT_CONFIG_NOSYSTEM example convinced me. In v9,
asking for several variables omits the ones with no value and exits 0.
Non-zero is reserved for real errors such as an unknown variable name, so
callers can detect those from the exit code alone. A single variable
still exits 1 when it has no value.
The string_list conversion is split out as you suggested:
1/4 var: represent multi-valued variables with a string_list
2/4 var: add "-z" output mode
3/4 var: accept more than one variable
4/4 var: add broken-out identity variables
parse_options() sits in 2/4, since "-z" is what requires it.
GIT_CONFIG_GLOBAL is now documented as multi-valued, and the tests use
nul_to_q instead of test_cmp over files containing NUL.
One place I did not follow you: instead of a trailing delimiter for a
multi-valued variable when argc > 1, each value gets its own entry:
$ git var GIT_AUTHOR_IDENT GIT_CONFIG_GLOBAL
GIT_AUTHOR_IDENT=A U Thor <author@example.com> 1112912053 -0700
GIT_CONFIG_GLOBAL=/home/me/.config/git/config
GIT_CONFIG_GLOBAL=/home/me/.gitconfig
Same shape as "git var -l", so one parser handles both. Happy to switch
if you prefer the trailing delimiter. I should have raised it last time
instead of just changing it.
Thanks,
Andrew
next prev parent reply other threads:[~2026-09-26 16:19 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
2026-09-15 22:02 ` Andrew Pleeter
2026-09-22 14:57 ` Phillip Wood
2026-09-26 16:19 ` Andrew Pleeter [this message]
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=20260926161951.30531-1-andrewpleeter@gmail.com \
--to=andrewpleeter@gmail.com \
--cc=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=phillip.wood@dunelm.org.uk \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox