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

@ -85,6 +85,15 @@ int check_signature(const char *payload, size_t plen, const char *signature,
return sigc->result != 'G' && sigc->result != 'U';
}
void print_signature_buffer(const struct signature_check *sigc, unsigned flags)
{
if (flags & GPG_VERIFY_VERBOSE && sigc->payload)
fputs(sigc->payload, stdout);
if (sigc->gpg_output)
fputs(sigc->gpg_output, stderr);
}
/*
* Look at GPG signed content (e.g. a signed tag object), whose
* payload is followed by a detached signature on it. Return the