From: Santiago Torres Arias <santiago@nyu.edu>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, gitster@pobox.com, sunshine@sunshineco.us,
walters@verbum.org
Subject: Re: [PATCH 2/2] builtin/verify-tag: do not omit gpg on --format
Date: Thu, 9 May 2019 13:40:17 -0400 [thread overview]
Message-ID: <20190509174016.us3pvef3bevfe2lb@LykOS.localdomain> (raw)
In-Reply-To: <20190509074455.GB24493@sigill.intra.peff.net>
[-- Attachment #1: Type: text/plain, Size: 2327 bytes --]
> Now this one's VERBOSE handling is a bit interesting. Previously we'd
> set VERBOSE even if we were going to show a format. And then later we
> just set the OMIT_STATUS bit, leaving VERBOSE in place:
>
> > - flags |= GPG_VERIFY_OMIT_STATUS;
>
> That _usually_ didn't matter because with OMIT_STATUS, we'd never enter
> print_signature_buffer(), which is where VERBOSE would usually kick in.
> But there's another spot we look at it:
>
> $ grep -nC2 VERBOSE tag.c
> 22-
> 23- if (size == payload_size) {
> 24: if (flags & GPG_VERIFY_VERBOSE)
> 25- write_in_full(1, buf, payload_size);
> 26- return error("no signature found");
>
> So the code prior to your patch actually had another weird behavior. Try
> this:
>
> $ git verify-tag -v --format='my tag is %(tag)' v2.21.0
> my tag is v2.21.0
>
> $ git tag -m bar foo
> $ git verify-tag -v --format='my tag is %(tag)' foo
> object 66395b630f8ca08705b36c359415af8b25da9a11
> type commit
> tag foo
> tagger Jeff King <peff@peff.net> 1557387618 -0400
>
> bar
> error: no signature found
>
> The "-v" only kicks in when there's an error. I think what your patch is
> doing (consistently ignoring "-v" when there's a format) makes more
> sense. It may be worth alerting the user when "-v" and "--format" are
> used together (or arguably we should _always_ show "-v" if the user
> really asked for it, but it does not make any sense to me for somebody
> to do so).
Aha! I completely missed this but it is indeed weird. Something
similar happened to me when I was sketching some patches for tag
verification in a downstream project...
> > - if (format.format) {
> > + if (format.format)
> > if (verify_ref_format(&format))
> > usage_with_options(verify_tag_usage,
> > verify_tag_options);
> > - }
>
> This leaves us with a weird doubled conditional (with no braces
> either!). Maybe:
>
> if (format.format && verify_ref_format(&format))
> usage_with_options(...);
>
> ?
Yes, I think chaining this if here is cleaner/less error prone.
>
> Other than that, the patch looks good. I think it could use a test in
> t7030, though.
Let me make a re-roll with these changes included and a test suite for
both t7030 or t7004.
Thanks!
-Santiago.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2019-05-09 17:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-27 20:21 [PATCH 0/2] tag verification: do not mute gpg output santiago
2019-04-27 20:21 ` [PATCH 1/2] builtin/tag: do not omit -v gpg out for --format santiago
2019-05-09 7:36 ` Jeff King
2019-05-09 17:36 ` Santiago Torres Arias
2019-04-27 20:21 ` [PATCH 2/2] builtin/verify-tag: do not omit gpg on --format santiago
2019-05-09 7:44 ` Jeff King
2019-05-09 17:40 ` Santiago Torres Arias [this message]
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=20190509174016.us3pvef3bevfe2lb@LykOS.localdomain \
--to=santiago@nyu.edu \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=sunshine@sunshineco.us \
--cc=walters@verbum.org \
/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).