diff options
author | Billy Lynch <billy@chainguard.dev> | 2024-01-11 14:42:52 -0500 |
---|---|---|
committer | Billy Lynch <billy@chainguard.dev> | 2024-01-18 12:56:55 -0500 |
commit | e1bb0e2cb68265458d4540ae566c255263d918a2 (patch) | |
tree | 139795e0c80abefba237d422952d7cfa9e84deef /options.go | |
parent | a6e934f1f76996c7f92cb4fde708170c1eb5d032 (diff) | |
download | go-git-e1bb0e2cb68265458d4540ae566c255263d918a2.tar.gz |
git: worktree_commit, Add crypto.Signer option to CommitOptions.
This change adds a new crypto.Signer option to CommitOptions as an
alternative to SignKey to allow alternative commit signers to be used.
This change byitself does not add other signing methods (e.g. ssh,
x509, gitsign), but gives callers the ability to add their own.
This roughly follows git's sign_buffer approach where go-git handles the
commit message body encoding, and hands off the encoded []byte to the signing
implementation for the signature to be returned.
Signed-off-by: Billy Lynch <billy@chainguard.dev>
Diffstat (limited to 'options.go')
-rw-r--r-- | options.go | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -1,6 +1,7 @@ package git import ( + "crypto" "errors" "fmt" "regexp" @@ -507,6 +508,10 @@ type CommitOptions struct { // commit will not be signed. The private key must be present and already // decrypted. SignKey *openpgp.Entity + // Signer denotes a cryptographic signer to sign the commit with. + // A nil value here means the commit will not be signed. + // Takes precedence over SignKey. + Signer crypto.Signer // Amend will create a new commit object and replace the commit that HEAD currently // points to. Cannot be used with All nor Parents. Amend bool |