Skip to content

Commit

Permalink
gpg-interface: provide access to the payload
Browse files Browse the repository at this point in the history
In contrast to tag signatures, commit signatures are put into the
header, that is between the other header parts and commit messages.

Provide access to the commit content sans the signature, which is the
payload that is actually signed. Commit signature verification does the
parsing anyways, and callers may wish to act on or display the commit
object sans the signature.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michael J Gruber authored and Junio C Hamano committed Jun 23, 2014
1 parent 01e57b5 commit 71c214c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,7 @@ void check_commit_signature(const struct commit* commit, struct signature_check
&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);
Expand Down
2 changes: 2 additions & 0 deletions gpg-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ static const char *gpg_program = "gpg";

void signature_check_clear(struct signature_check *sigc)
{
free(sigc->payload);
free(sigc->gpg_output);
free(sigc->gpg_status);
free(sigc->signer);
free(sigc->key);
sigc->payload = NULL;
sigc->gpg_output = NULL;
sigc->gpg_status = NULL;
sigc->signer = NULL;
Expand Down
1 change: 1 addition & 0 deletions gpg-interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define GPG_INTERFACE_H

struct signature_check {
char *payload;
char *gpg_output;
char *gpg_status;
char result; /* 0 (not checked),
Expand Down

0 comments on commit 71c214c

Please sign in to comment.