diff options
author | Chris Marchesi <chrism@vancluevertech.com> | 2018-08-16 17:46:07 -0700 |
---|---|---|
committer | Chris Marchesi <chrism@vancluevertech.com> | 2018-08-16 17:53:36 -0700 |
commit | 0ef699d06cd038b73ea22a6d1eb19aff2761156f (patch) | |
tree | d0623f8db4d5fd7cbe0b827c9a6701b7df685181 /options.go | |
parent | ec3d2a817d7cf43696a42d8460c7a8957a12a57b (diff) | |
download | go-git-0ef699d06cd038b73ea22a6d1eb19aff2761156f.tar.gz |
git: Add ability to PGP sign commits
This adds the ability to sign commits by adding the SignKey field to
CommitOptions. If present, the commit will be signed during the
WorkTree.Commit call.
The supplied SignKey must already be decrypted by the caller.
Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
Diffstat (limited to 'options.go')
-rw-r--r-- | options.go | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -4,6 +4,7 @@ import ( "errors" "regexp" + "golang.org/x/crypto/openpgp" "gopkg.in/src-d/go-git.v4/config" "gopkg.in/src-d/go-git.v4/plumbing" "gopkg.in/src-d/go-git.v4/plumbing/object" @@ -347,6 +348,9 @@ type CommitOptions struct { // Parents are the parents commits for the new commit, by default when // len(Parents) is zero, the hash of HEAD reference is used. Parents []plumbing.Hash + // A key to sign the commit with. A nil value here means the commit will not + // be signed. The private key must be present and already decrypted. + SignKey *openpgp.Entity } // Validate validates the fields and sets the default values. |