diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-08-03 11:01:12 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-08-03 11:01:12 -0700 |
commit | ba12cb299f831f29c256c644b01108710c2629e6 (patch) | |
tree | 9887b1a34695488488f7ea86f9906c93e2164543 /commit.c | |
parent | e7cf4b257179b4683fa32beb51f949666d36fe9c (diff) | |
parent | e18443ece711564145d545b650851c4615717128 (diff) | |
download | git-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.c | 21 |
1 files changed, 6 insertions, 15 deletions
@@ -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; } |