aboutsummaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-08-03 11:01:12 -0700
committerJunio C Hamano <gitster@pobox.com>2015-08-03 11:01:12 -0700
commitba12cb299f831f29c256c644b01108710c2629e6 (patch)
tree9887b1a34695488488f7ea86f9906c93e2164543 /commit.c
parente7cf4b257179b4683fa32beb51f949666d36fe9c (diff)
parente18443ece711564145d545b650851c4615717128 (diff)
downloadgit-ba12cb299f831f29c256c644b01108710c2629e6.tar.gz
git-ba12cb299f831f29c256c644b01108710c2629e6.tar.xz
Merge branch 'bc/gpg-verify-raw'
"git verify-tag" and "git verify-commit" have been taught to share more code, and then learned to optionally show the verification message from the underlying GPG implementation. * bc/gpg-verify-raw: verify-tag: add option to print raw gpg status information verify-commit: add option to print raw gpg status information gpg: centralize printing signature buffers gpg: centralize signature check verify-commit: add test for exit status on untrusted signature verify-tag: share code with verify-commit verify-tag: add tests
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/commit.c b/commit.c
index 6e2103cef..62223a33e 100644
--- a/commit.c
+++ b/commit.c
@@ -1232,33 +1232,24 @@ free_return:
free(buf);
}
-void check_commit_signature(const struct commit *commit, struct signature_check *sigc)
+int check_commit_signature(const struct commit *commit, struct signature_check *sigc)
{
struct strbuf payload = STRBUF_INIT;
struct strbuf signature = STRBUF_INIT;
- struct strbuf gpg_output = STRBUF_INIT;
- struct strbuf gpg_status = STRBUF_INIT;
- int status;
+ int ret = 1;
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);
+ ret = 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);
+
+ return ret;
}