From: Junio C Hamano <gitster@pobox.com>
To: Hans Jerry Illikainen <hji@dyntopia.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/5] gpg-interface: support one-line summaries in print_signature_buffer()
Date: Mon, 06 Jan 2020 11:33:48 -0800 [thread overview]
Message-ID: <xmqqy2uk8jmr.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20200105135616.19102-3-hji@dyntopia.com> (Hans Jerry Illikainen's message of "Sun, 5 Jan 2020 13:56:13 +0000")
Hans Jerry Illikainen <hji@dyntopia.com> writes:
> Most consumers of the GPG interface use print_signature_buffer() to show
> This patch moves the one-line summary from verify_merge_signature() to
> print_signature_buffer(). It also introduces a GPG_VERIFY_SHORT flag
> that determines whether the summary should be printed.
I think the motivation makes sense.
> -void print_signature_buffer(const struct signature_check *sigc, unsigned flags)
> +void print_signature_buffer(const struct object_id *oid,
> + const struct signature_check *sigc, int status,
> + unsigned flags)
> {
> const char *output = flags & GPG_VERIFY_RAW ?
> sigc->gpg_status : sigc->gpg_output;
> + char hex[GIT_MAX_HEXSZ + 1];
> + char *type;
>
> if (flags & GPG_VERIFY_VERBOSE && sigc->payload)
> fputs(sigc->payload, stdout);
>
> if (flags & GPG_VERIFY_FULL && output)
> fputs(output, stderr);
> +
> + if (flags & GPG_VERIFY_SHORT && oid) {
I am not sure about the wisdom of "&& oid" here. Wouldn't it be a
bug for a caller who asks for _SHORT format to feed a NULL oid to
us? I would understand
if (flags & GPG_VERIFY_SHORT) {
if (!oid)
BUG("Caller asking for SHORT without oid???");
much better, but if there is a caller that has a legitimate need
tobe able to pass NULL and still request SHORT, let's see it and
discuss if it is a good idea.
For that matter, the two print routines we have immediately above
share the same issue.
> + type = xstrdup_or_null(
> + type_name(oid_object_info(the_repository, oid, NULL)));
> + if (!type)
> + type = xstrdup("object");
This is minor, but I wonder if this is easier to follow.
type = type_name(oid_object_info(the_repository, oid, NULL));
if (!type)
type = "object";
type = xstrdup(type);
> + *type = toupper(*type);
This is not helpful at all for i18n/l10n, I am afraid.
> + find_unique_abbrev_r(hex, oid, DEFAULT_ABBREV);
> +
> + switch (sigc->result) {
> + case 'G':
> + if (status)
> + error(_("%s %s has an untrusted GPG signature, "
> + "allegedly by %s."),
> + type, hex, sigc->signer);
The original was of course
die(_("Commit %s has an untrusted GPG signature, "
"allegedly by %s."), hex, signature_check.signer);
so the message can properly localized including the typename. That
is no longer true with this conversion.
You probably would need to prepare a 3-element array (one element
for each of <object, commit, tag>), each element of the array being
a 3-element array that holds the message for these three cases
(i.e. G, N and default) instead.
next prev parent reply other threads:[~2020-01-06 19:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-05 13:56 [PATCH 0/5] refactor gpg-interface and add gpg verification for clones Hans Jerry Illikainen
2020-01-05 13:56 ` [PATCH 1/5] gpg-interface: conditionally show the result in print_signature_buffer() Hans Jerry Illikainen
2020-01-06 19:07 ` Junio C Hamano
2020-01-05 13:56 ` [PATCH 2/5] gpg-interface: support one-line summaries " Hans Jerry Illikainen
2020-01-06 19:33 ` Junio C Hamano [this message]
2020-01-05 13:56 ` [PATCH 3/5] commit: refactor signature verification helpers Hans Jerry Illikainen
2020-01-06 19:36 ` Junio C Hamano
2020-01-05 13:56 ` [PATCH 4/5] merge: verify signatures if gpg.verifySignatures is true Hans Jerry Illikainen
2020-01-06 21:01 ` Junio C Hamano
2020-01-05 13:56 ` [PATCH 5/5] clone: support signature verification Hans Jerry Illikainen
2020-01-05 23:11 ` [PATCH 0/5] refactor gpg-interface and add gpg verification for clones Junio C Hamano
2020-01-07 4:06 ` Hans Jerry Illikainen
2020-01-07 16:54 ` Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqy2uk8jmr.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=hji@dyntopia.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).