git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Santiago Torres <santiago@nyu.edu>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, peff@peff.net, sunshine@sunshineco.com,
	walters@verbum.org, Lukas P <luk.puehringer@gmail.com>,
	Lukas Puehringer <lukas.puehringer@nyu.edu>
Subject: Re: [PATCH 4/6] tag: add format specifier to gpg_verify_tag
Date: Fri, 23 Sep 2016 10:36:25 -0400	[thread overview]
Message-ID: <20160923143625.ynnzgkikj625f6ij@LykOS.localdomain> (raw)
In-Reply-To: <xmqqponv3b4x.fsf@gitster.mtv.corp.google.com>

[-- Attachment #1: Type: text/plain, Size: 2441 bytes --]

On Thu, Sep 22, 2016 at 01:58:06PM -0700, Junio C Hamano wrote:
> santiago@nyu.edu writes:
> 
> > Calling functions for gpg_verify_tag() may desire to print relevant
> > information about the header for further verification. Add an optional
> > format argument to print any desired information after GPG verification.
> 
> > diff --git a/builtin/tag.c b/builtin/tag.c
> > index dbf271f..94ed8a2 100644
> > --- a/builtin/tag.c
> > +++ b/builtin/tag.c
> > @@ -106,7 +106,7 @@ static int delete_tag(const char *name, const char *ref,
> >  static int verify_tag(const char *name, const char *ref,
> >  				const unsigned char *sha1)
> >  {
> > -	return gpg_verify_tag(sha1, name, GPG_VERIFY_VERBOSE);
> > +	return verify_and_format_tag(sha1, name, NULL, GPG_VERIFY_VERBOSE);
> >  }
> >  
> >  static int do_sign(struct strbuf *buffer)
> > diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c
> > index 99f8148..7a1121b 100644
> > --- a/builtin/verify-tag.c
> > +++ b/builtin/verify-tag.c
> > @@ -51,8 +51,10 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)
> >  		const char *name = argv[i++];
> >  		if (get_sha1(name, sha1))
> >  			had_error = !!error("tag '%s' not found.", name);
> > -		else if (gpg_verify_tag(sha1, name, flags))
> > -			had_error = 1;
> > +		else {
> > +			if (verify_and_format_tag(sha1, name, NULL, flags))
> > +				had_error = 1;
> > +		}
> 
> Revert the unnecessary reformatting here.
> 
> > @@ -56,6 +57,15 @@ int gpg_verify_tag(const unsigned char *sha1, const char *name_to_report,
> >  	ret = run_gpg_verify(buf, size, flags);
> >  
> >  	free(buf);
> > +
> > +	if (fmt_pretty) {
> > +		struct ref_array_item *ref_item;
> > +		ref_item = new_ref_item(name_to_report, sha1, 0);
> > +		ref_item->kind = FILTER_REFS_TAGS;
> > +		show_ref_item(ref_item, fmt_pretty, 0);
> > +		free_ref_item(ref_item);
> > +	}
> 
> I haven't seen 5/6 and 6/6, but if this is the only user of the 3/6,
> it would be much better to have a single function to format a ref
> exported from ref-filter.[ch] so that this one can say
> 
> 	if (fmt_pretty)
>         	format_ref(name_to_report, sha1, FILTER_REFS_TAGS);
> 
> or something like that, instead of doing three that will always be
> used together in quick succession in the above pattern.

Oh, this sounds like a better alternative. This would be instead of 0003
right? 

Thanks,
-Santiago.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

  reply	other threads:[~2016-09-23 14:36 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 [this message]
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
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=20160923143625.ynnzgkikj625f6ij@LykOS.localdomain \
    --to=santiago@nyu.edu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=luk.puehringer@gmail.com \
    --cc=lukas.puehringer@nyu.edu \
    --cc=peff@peff.net \
    --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).