Skip to content

Commit 0623774

Browse files
committed
Add commit payload
1 parent 6309a1e commit 0623774

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

repo_commit.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ l:
7979
}
8080
commit.Committer = sig
8181
case "gpgsig":
82-
verif, err := newVerificationFromCommitline(data[nextline+spacepos+1:])
82+
verif, err := newVerificationFromCommitline(data, nextline+spacepos+1)
8383
if err != nil {
8484
return nil, err
8585
}

verification.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ type Verification struct {
3636
// -----END PGP SIGNATURE-----
3737
// but without the "gpgsig " at the beginning
3838
//
39-
func newVerificationFromCommitline(line []byte) (_ *Verification, err error) {
39+
func newVerificationFromCommitline(data []byte, signatureStart int) (_ *Verification, err error) {
4040
verif := new(Verification)
41-
42-
signatureEnd := bytes.LastIndex(line, []byte("-----END PGP SIGNATURE-----"))
43-
verif.Signature = string(line[:signatureEnd+27])
41+
verif.Payload = string(data[:signatureStart-8])
42+
signatureEnd := bytes.LastIndex(data, []byte("-----END PGP SIGNATURE-----"))
43+
verif.Signature = string(data[signatureStart : signatureEnd+27])
4444

4545
return verif, nil
4646
}

0 commit comments

Comments
 (0)