Skip to content

Commit 71c214c

Browse files
Michael J Grubergitster
Michael J Gruber
authored andcommittedJun 23, 2014
gpg-interface: provide access to the payload
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>
1 parent 01e57b5 commit 71c214c

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed
 

‎commit.c

+1
Original file line numberDiff line numberDiff line change
@@ -1219,6 +1219,7 @@ void check_commit_signature(const struct commit* commit, struct signature_check
12191219
&gpg_output, &gpg_status);
12201220
if (status && !gpg_output.len)
12211221
goto out;
1222+
sigc->payload = strbuf_detach(&payload, NULL);
12221223
sigc->gpg_output = strbuf_detach(&gpg_output, NULL);
12231224
sigc->gpg_status = strbuf_detach(&gpg_status, NULL);
12241225
parse_gpg_output(sigc);

‎gpg-interface.c

+2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ static const char *gpg_program = "gpg";
99

1010
void signature_check_clear(struct signature_check *sigc)
1111
{
12+
free(sigc->payload);
1213
free(sigc->gpg_output);
1314
free(sigc->gpg_status);
1415
free(sigc->signer);
1516
free(sigc->key);
17+
sigc->payload = NULL;
1618
sigc->gpg_output = NULL;
1719
sigc->gpg_status = NULL;
1820
sigc->signer = NULL;

‎gpg-interface.h

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define GPG_INTERFACE_H
33

44
struct signature_check {
5+
char *payload;
56
char *gpg_output;
67
char *gpg_status;
78
char result; /* 0 (not checked),

0 commit comments

Comments
 (0)