git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: santiago@nyu.edu
Cc: git@vger.kernel.org, peff@peff.net, sunshine@sunshineco.com,
	walters@verbum.org
Subject: Re: [PATCH 5/6] builtin/verify-tag: Add --format to verify-tag
Date: Thu, 22 Sep 2016 14:16:21 -0700	[thread overview]
Message-ID: <xmqqintn3aai.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160922185317.349-6-santiago@nyu.edu> (santiago@nyu.edu's message of "Thu, 22 Sep 2016 14:53:16 -0400")

santiago@nyu.edu writes:

> From: Santiago Torres <santiago@nyu.edu>
>
> Callers of verify-tag may want to cross-check the tagname from refs/tags
> with the tagname from the tag object header upon GPG verification. This
> is to avoid tag refs that point to an incorrect object.
>
> Add a --format parameter to git verify-tag to print the formatted tag
> object header in addition to or instead of the --verbose or --raw GPG
> verification output.
>
> Signed-off-by: Santiago Torres <santiago@nyu.edu>
> ---
>  builtin/verify-tag.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c
> index 7a1121b..319d469 100644
> --- a/builtin/verify-tag.c
> +++ b/builtin/verify-tag.c
> @@ -12,12 +12,15 @@
>  #include <signal.h>
>  #include "parse-options.h"
>  #include "gpg-interface.h"
> +#include "ref-filter.h"
>  
>  static const char * const verify_tag_usage[] = {
> -		N_("git verify-tag [-v | --verbose] <tag>..."),
> +		N_("git verify-tag [-v | --verbose] [--format=<format>] <tag>..."),
>  		NULL
>  };
>  
> +char *fmt_pretty;

Does this have to be extern?  I do not think so; prepend "static "
in front of it.

>  	while (i < argc) {
>  		unsigned char sha1[20];
>  		const char *name = argv[i++];
>  		if (get_sha1(name, sha1))
>  			had_error = !!error("tag '%s' not found.", name);
>  		else {
> -			if (verify_and_format_tag(sha1, name, NULL, flags))
> +			if (verify_and_format_tag(sha1, name, fmt_pretty, flags))

OK.  The callchain from here is

    verify_and_format_tag()
    -> run_gpg_verify()
      -> print_signature_buffer()

so not cramming QUIET into the flags parameter that is already
passed is cumbersome.  As I said in my earlier review, it would make
more sense to have the conditional NOT in print_signature_buffer()
but in its caller, but it still is OK to add GPG_VERIFY_QUIET bit
to the flag, which you would check in run_gpg_verify() to decide not
to call print_signature_buffer().


  reply	other threads:[~2016-09-22 21:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22 18:53 [RFC/PATCH 0/6] Add --format to tag verification santiago
2016-09-22 18:53 ` [PATCH 1/6] builtin/tag: move format specifier to global var santiago
2016-09-22 20:23   ` Junio C Hamano
2016-09-22 18:53 ` [PATCH 2/6] gpg-interface: add GPG_VERIFY_QUIET flag santiago
2016-09-22 20:25   ` Junio C Hamano
2016-09-22 20:44   ` Junio C Hamano
2016-09-22 18:53 ` [PATCH 3/6] ref-filter: Expose wrappers for ref_item functions santiago
2016-09-22 20:50   ` Junio C Hamano
2016-09-22 18:53 ` [PATCH 4/6] tag: add format specifier to gpg_verify_tag santiago
2016-09-22 20:58   ` Junio C Hamano
2016-09-23 14:36     ` Santiago Torres
2016-09-22 18:53 ` [PATCH 5/6] builtin/verify-tag: Add --format to verify-tag santiago
2016-09-22 21:16   ` Junio C Hamano [this message]
2016-09-23 14:35     ` Santiago Torres
2016-09-22 18:53 ` [PATCH 6/6] builtin/tag: add --format argument for tag -v santiago
2016-09-22 21:23   ` Junio C Hamano
2016-09-23 14:34     ` Santiago Torres
2016-09-22 19:01 ` [RFC/PATCH 0/6] Add --format to tag verification Stefan Beller
2016-09-24 19:09   ` Jakub Narębski

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=xmqqintn3aai.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=santiago@nyu.edu \
    --cc=sunshine@sunshineco.com \
    --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).