diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2015-06-21 23:14:38 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-06-22 14:20:45 -0700 |
commit | a4cc18f2934b8d2f00c7c3e11107acb6bfafe2c6 (patch) | |
tree | d01e654e36d66e2abfb3513d9c716be752a22451 /builtin/verify-tag.c | |
parent | verify-tag: add tests (diff) | |
download | tgif-a4cc18f2934b8d2f00c7c3e11107acb6bfafe2c6.tar.xz |
verify-tag: share code with verify-commit
verify-tag was executing an entirely different codepath than
verify-commit, except for the underlying verify_signed_buffer. Move
much of the code from check_commit_signature to a generic
check_signature function and adjust both codepaths to call it.
Update verify-tag to explicitly output the signature text, as we now
call verify_signed_buffer with strbufs to catch the output, which
prevents it from being printed automatically.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/verify-tag.c')
-rw-r--r-- | builtin/verify-tag.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c index 53c68fce3a..e1eb341bae 100644 --- a/builtin/verify-tag.c +++ b/builtin/verify-tag.c @@ -20,8 +20,11 @@ static const char * const verify_tag_usage[] = { static int run_gpg_verify(const char *buf, unsigned long size, int verbose) { + struct signature_check sigc; int len; + memset(&sigc, 0, sizeof(sigc)); + len = parse_signature(buf, size); if (verbose) write_in_full(1, buf, len); @@ -29,7 +32,11 @@ static int run_gpg_verify(const char *buf, unsigned long size, int verbose) if (size == len) return error("no signature found"); - return verify_signed_buffer(buf, len, buf + len, size - len, NULL, NULL); + check_signature(buf, len, buf + len, size - len, &sigc); + fputs(sigc.gpg_output, stderr); + + signature_check_clear(&sigc); + return sigc.result != 'G' && sigc.result != 'U'; } static int verify_tag(const char *name, int verbose) |