From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] tag: convert gpg_verify_tag to use struct object_id
Date: Thu, 13 Jul 2017 13:52:05 -0700 [thread overview]
Message-ID: <xmqq4lugukju.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170713004415.5051-2-sbeller@google.com> (Stefan Beller's message of "Wed, 12 Jul 2017 17:44:15 -0700")
Stefan Beller <sbeller@google.com> writes:
> diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c
> index f9a5f7535a..ed8329340f 100644
> --- a/builtin/verify-tag.c
> +++ b/builtin/verify-tag.c
> @@ -56,20 +56,21 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)
> }
>
> while (i < argc) {
> - unsigned char sha1[20];
> + struct object_id oid;
> const char *name = argv[i++];
> - if (get_sha1(name, sha1)) {
> +
> + if (get_oid(name, &oid)) {
> had_error = !!error("tag '%s' not found.", name);
> continue;
> }
This part is already done, it seems, in bc/object-id topic, even
though other parts are not yet done?
>
> - if (gpg_verify_tag(sha1, name, flags)) {
> + if (gpg_verify_tag(&oid, name, flags)) {
> had_error = 1;
> continue;
> }
>
> if (fmt_pretty)
> - pretty_print_ref(name, sha1, fmt_pretty);
> + pretty_print_ref(name, oid.hash, fmt_pretty);
> }
> return had_error;
> }
> diff --git a/tag.c b/tag.c
> index 47f60ae151..7e10acfb6e 100644
> --- a/tag.c
> +++ b/tag.c
> @@ -33,7 +33,7 @@ static int run_gpg_verify(const char *buf, unsigned long size, unsigned flags)
> return ret;
> }
>
> -int gpg_verify_tag(const unsigned char *sha1, const char *name_to_report,
> +int gpg_verify_tag(const struct object_id *oid, const char *name_to_report,
> unsigned flags)
> {
> enum object_type type;
> @@ -41,20 +41,20 @@ int gpg_verify_tag(const unsigned char *sha1, const char *name_to_report,
> unsigned long size;
> int ret;
>
> - type = sha1_object_info(sha1, NULL);
> + type = sha1_object_info(oid->hash, NULL);
> if (type != OBJ_TAG)
> return error("%s: cannot verify a non-tag object of type %s.",
> name_to_report ?
> name_to_report :
> - find_unique_abbrev(sha1, DEFAULT_ABBREV),
> + find_unique_abbrev(oid->hash, DEFAULT_ABBREV),
> typename(type));
>
> - buf = read_sha1_file(sha1, &type, &size);
> + buf = read_sha1_file(oid->hash, &type, &size);
> if (!buf)
> return error("%s: unable to read file.",
> name_to_report ?
> name_to_report :
> - find_unique_abbrev(sha1, DEFAULT_ABBREV));
> + find_unique_abbrev(oid->hash, DEFAULT_ABBREV));
>
> ret = run_gpg_verify(buf, size, flags);
>
> diff --git a/tag.h b/tag.h
> index fdfcb4a84a..d469534e82 100644
> --- a/tag.h
> +++ b/tag.h
> @@ -17,7 +17,7 @@ extern int parse_tag_buffer(struct tag *item, const void *data, unsigned long si
> extern int parse_tag(struct tag *item);
> extern struct object *deref_tag(struct object *, const char *, int);
> extern struct object *deref_tag_noverify(struct object *);
> -extern int gpg_verify_tag(const unsigned char *sha1,
> +extern int gpg_verify_tag(const struct object_id *oid,
> const char *name_to_report, unsigned flags);
>
> #endif /* TAG_H */
next prev parent reply other threads:[~2017-07-13 20:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-13 0:44 [PATCH 1/2] commit: convert lookup_commit_graft to struct object_id Stefan Beller
2017-07-13 0:44 ` [PATCH 2/2] tag: convert gpg_verify_tag to use " Stefan Beller
2017-07-13 19:02 ` Junio C Hamano
2017-07-13 20:52 ` Junio C Hamano [this message]
2017-07-13 21:00 ` Stefan Beller
2017-07-13 21:23 ` Junio C Hamano
2017-07-13 21:49 ` Stefan Beller
2017-07-13 23:45 ` brian m. carlson
2017-07-13 2:26 ` [PATCH 1/2] commit: convert lookup_commit_graft to " brian m. carlson
2017-07-13 18: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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq4lugukju.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=sbeller@google.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.