Skip to content

Commit

Permalink
Add commit payload
Browse files Browse the repository at this point in the history
  • Loading branch information
sapk committed Oct 13, 2016
1 parent 6309a1e commit 0623774
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion repo_commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ l:
}
commit.Committer = sig
case "gpgsig":
verif, err := newVerificationFromCommitline(data[nextline+spacepos+1:])
verif, err := newVerificationFromCommitline(data, nextline+spacepos+1)
if err != nil {
return nil, err
}
Expand Down
8 changes: 4 additions & 4 deletions verification.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ type Verification struct {
// -----END PGP SIGNATURE-----
// but without the "gpgsig " at the beginning
//
func newVerificationFromCommitline(line []byte) (_ *Verification, err error) {
func newVerificationFromCommitline(data []byte, signatureStart int) (_ *Verification, err error) {
verif := new(Verification)

signatureEnd := bytes.LastIndex(line, []byte("-----END PGP SIGNATURE-----"))
verif.Signature = string(line[:signatureEnd+27])
verif.Payload = string(data[:signatureStart-8])
signatureEnd := bytes.LastIndex(data, []byte("-----END PGP SIGNATURE-----"))
verif.Signature = string(data[signatureStart : signatureEnd+27])

return verif, nil
}

0 comments on commit 0623774

Please sign in to comment.