From 0106b1d4be166fd4f7bcf0b901d50940c9f539e2 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 28 Feb 2020 09:43:17 -0800 Subject: Revert "gpg-interface: prefer check_signature() for GPG verification" This reverts commit 72b006f4bfd30b7c5037c163efaf279ab65bea9c, which breaks the end-user experience when merging a signed tag without having the public key. We should report "can't check because we have no public key", but the code with this change claimed that there was no signature. --- builtin/fmt-merge-msg.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'builtin/fmt-merge-msg.c') diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c index f7ed102d8b..a4615587fd 100644 --- a/builtin/fmt-merge-msg.c +++ b/builtin/fmt-merge-msg.c @@ -495,7 +495,6 @@ static void fmt_merge_msg_sigs(struct strbuf *out) enum object_type type; unsigned long size, len; char *buf = read_object_file(oid, &type, &size); - struct signature_check sigc = { 0 }; struct strbuf sig = STRBUF_INIT; if (!buf || type != OBJ_TAG) @@ -504,12 +503,10 @@ static void fmt_merge_msg_sigs(struct strbuf *out) if (size == len) ; /* merely annotated */ - else if (!check_signature(buf, len, buf + len, size - len, - &sigc)) { - strbuf_addstr(&sig, sigc.gpg_output); - signature_check_clear(&sigc); - } else - strbuf_addstr(&sig, "gpg verification failed.\n"); + else if (verify_signed_buffer(buf, len, buf + len, size - len, &sig, NULL)) { + if (!sig.len) + strbuf_addstr(&sig, "gpg verification failed.\n"); + } if (!tag_number++) { fmt_tag_signature(&tagbuf, &sig, buf, len); -- cgit v1.2.3