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 /commit.c | |
parent | d66aeff21e8ce92d742aa04c5e59ca3eee5e39d8 (diff) | |
download | git-a4cc18f2934b8d2f00c7c3e11107acb6bfafe2c6.tar.gz |
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 'commit.c')
-rw-r--r-- | commit.c | 15 |
1 files changed, 1 insertions, 14 deletions
@@ -1231,27 +1231,14 @@ void check_commit_signature(const struct commit *commit, struct signature_check { struct strbuf payload = STRBUF_INIT; struct strbuf signature = STRBUF_INIT; - struct strbuf gpg_output = STRBUF_INIT; - struct strbuf gpg_status = STRBUF_INIT; - int status; sigc->result = 'N'; if (parse_signed_commit(commit, &payload, &signature) <= 0) goto out; - status = verify_signed_buffer(payload.buf, payload.len, - signature.buf, signature.len, - &gpg_output, &gpg_status); - if (status && !gpg_output.len) - goto out; - sigc->payload = strbuf_detach(&payload, NULL); - sigc->gpg_output = strbuf_detach(&gpg_output, NULL); - sigc->gpg_status = strbuf_detach(&gpg_status, NULL); - parse_gpg_output(sigc); + check_signature(payload.buf, payload.len, signature.buf, signature.len, sigc); out: - strbuf_release(&gpg_status); - strbuf_release(&gpg_output); strbuf_release(&payload); strbuf_release(&signature); } |