gpg: centralize printing signature buffers

The code to handle printing of signature data from a struct
signature_check is very similar between verify-commit and verify-tag.
Place this in a single function.  verify-tag retains its special case
behavior of printing the tag even when no valid signature is found.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
brian m. carlson
2015-06-21 23:14:41 +00:00
committed by Junio C Hamano
parent 434060ec6d
commit ca194d50b8
4 changed files with 18 additions and 10 deletions

View File

@ -27,14 +27,15 @@ static int run_gpg_verify(const char *buf, unsigned long size, int verbose)
memset(&sigc, 0, sizeof(sigc));
len = parse_signature(buf, size);
if (verbose)
write_in_full(1, buf, len);
if (size == len)
if (size == len) {
if (verbose)
write_in_full(1, buf, len);
return error("no signature found");
}
ret = check_signature(buf, len, buf + len, size - len, &sigc);
fputs(sigc.gpg_output, stderr);
print_signature_buffer(&sigc, verbose ? GPG_VERIFY_VERBOSE : 0);
signature_check_clear(&sigc);
return ret;