From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Andrew Pleeter via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Andrew Pleeter <andrewpleeter@gmail.com>
Subject: Re: [PATCH] builtin/whoami: add new 'whoami' command
Date: Tue, 25 Aug 2026 21:24:30 +0000 [thread overview]
Message-ID: <ao4IDZMbgvTTYksS@fruit.crustytoothpaste.net> (raw)
In-Reply-To: <pull.2388.git.git.1787690802942.gitgitgadget@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3965 bytes --]
On 2026-08-25 at 20:46:42, Andrew Pleeter via GitGitGadget wrote:
> From: anpl1623 <andrewpleeter@gmail.com>
You will probably want this to match your real name since you're using
it in the email. We prefer that people use their real names, but don't
require it, but I assume that it's not a problem since you just CC'd
yourself using it (and it's also in your email address).
> Add a builtin 'whoami' command to inspect and display the resolved
> author and committer identity along with the commit signing
> configuration (GPG/SSH key ID and commit.gpgsign status) used when
> creating Git commits.
>
> Support optional flags (--author, --committer, --name, --email,
> --signing-key, and --verbose) for targeted querying and scripting.
I suspect users will want a way to get _all_ of the output in a
machine-readable way, so you'd probably want to provide some method of
doing that. Note that because your existing endpoints provide
translated strings, they are not suitable for this. That doesn't mean
that they should not be translated (because they should) but we'd
probably want a format like the following:
user.author.name=A U Thor
user.author.email=author@example.com
Other formats are possible, though.
Possibly a `-z` option for NUL-terminated instead of LF-terminated
output might be warranted as well unless we're certain that our output
will never contain a newline (hint: config options can).
> Include documentation in Documentation/git-whoami.adoc and regression
> tests in t/t0015-whoami.sh.
>
> Signed-off-by: anpl1623 <andrewpleeter@gmail.com>
Again, you'll want to sign this off with your real name.
> MOTIVATION
>
> Users often work across multiple environments, profiles, or repositories
> with different global/local configs and signing keys. Currently,
> verifying what identity and signing key will be attached to a new commit
> requires checking several individual git config and git var settings.
> git whoami provides a simple, direct porcelain command to verify this in
> one step.
I think this should go in the commit message. I thought to myself,
"Well, there are already ways to get this information, so why add a new
one?" Telling us why your patch is compelling and solves an important
purpose is appropriate for the commit message.
I might also like to see an explanation as to why this wouldn't work
better in `git var` or elsewhere instead, since much of the information
is already there. Since that's an alternative you've rejected, tell us
why and sell us on your vision.
> + repo_config(the_repository, git_default_config, NULL);
Let's not add more uses of `the_repository`. Use the `repo` argument to
the main function above, taking care to handle the NULL case.
> + repo_config_get_bool(the_repository, "commit.gpgsign", &gpgsign);
> + repo_config_get_string(the_repository, "user.signingkey", &signing_key);
> + repo_config_get_string(the_repository, "gpg.format", &gpg_format);
> + repo_config_get_string(the_repository, "gpg.ssh.defaultkeycommand", &ssh_default_key_cmd);
> +
> + is_ssh = gpg_format && !strcmp(gpg_format, "ssh");
> +
> + if (signing_key && *signing_key) {
> + resolved_key = xstrdup(signing_key);
> + } else if (is_ssh) {
> + if (ssh_default_key_cmd && *ssh_default_key_cmd)
> + resolved_key = get_signing_key_id();
> + } else if (gpgsign) {
> + resolved_key = get_signing_key_id();
> + }
Should this also do something useful for X.509 keys?
Overall, I don't have a strong need for this and I'm fine using the
existing functionality. However, I see how it could be useful and if it
were merged and available in the versions of Git I use, then I might
make use of it.
Perhaps others think this is compelling, though, so I'm interested to
hear other opinions about the utility of the command.
--
brian m. carlson (they/them)
Toronto, Ontario, CA
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 325 bytes --]
next prev parent reply other threads:[~2026-08-25 21:24 UTC|newest]
Thread overview: 20+ 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 [this message]
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
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=ao4IDZMbgvTTYksS@fruit.crustytoothpaste.net \
--to=sandals@crustytoothpaste.net \
--cc=andrewpleeter@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
/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.