git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] verify-tag: allow to verify signed blob objects

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 15, 2016, 18:39 UTC
Message-ID
<xmqq8ty670v2.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<a6557333316c6f7996fa54eebc75abdf988ed9f9.1465991212.git.git@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
Show 13 quoted lines
> diff --git a/tag.c b/tag.c
> index d1dcd18..d5f090b 100644
> --- a/tag.c
> +++ b/tag.c
> @@ -39,7 +39,7 @@ int gpg_verify_tag(const unsigned char *sha1, const char *name_to_report,
>  	int ret;
>  
>  	type = sha1_object_info(sha1, NULL);
> -	if (type != OBJ_TAG)
> +	if ((type != OBJ_TAG) && ((type != OBJ_BLOB) || !(flags & GPG_VERIFY_BLOB)))
>  		return error("%s: cannot verify a non-tag object of type %s.",
>  				name_to_report ?
>  				name_to_report :
The double negation is very hard to read.  I wonder
	if ((type != OBJ_TAG) &&
            !((type == OBJ_BLOB) && (flags & GPG_VERIFY_BLOB)))

is easier to follow? "It is not a tag object, and it's not like we were asked to verify blob and the user gave us a blob, either, so let's complain" is easier to follow, at least for me.

Or even
	if ((flags & GPG_VERIFY_BLOB) && (type != OBJ_BLOB))
               	"you told me to check blob but didn't give me one";
	} else if (type != OBJ_TAG)
		"you didn't give me a tag";
Previous: Michael J GruberNext: Michael J Gruber
Message 2 of 6 in “verify-tag: allow to verify signed blob objects”
  1. verify-tag: allow to verify signed blob objectsMichael J Gruber, Jun 15, 2016
  2. Junio C HamanoJun 15, 2016
  3. Michael J GruberJun 15, 2016
  4. Junio C HamanoJun 15, 2016
  5. Jacob KellerJun 15, 2016
  6. Junio C HamanoJun 16, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.