-
Notifications
You must be signed in to change notification settings - Fork 534
Conversation
The way that commit signatures were being written out was causing an extra newline to be written at the end of the commit when the message encoding was already taking care of this. Ultimately, this results in a corrupt object, rendering the object unverifiable with the signature in the commit. Signed-off-by: Chris Marchesi <[email protected]>
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 <[email protected]>
Looks like tests are failing due to use of I'll switch this up to using |
This was added in Go 1.10 and is not supported on Go 1.9. Switched to bytes.Buffer to ensure compatibility. Signed-off-by: Chris Marchesi <[email protected]>
This will not work for a signed commit as with the GPG signature being a part of the commit, the hash is now non-deterministic. Verification of the commit is done through the validation of the signature. Signed-off-by: Chris Marchesi <[email protected]>
I'm hoping this helps get codecov to a tolerable delta. :) Signed-off-by: Chris Marchesi <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than CI failing, looks good!
Just a minor comment on formatting.
encoded := &plumbing.MemoryObject{} | ||
if err := commit.Encode(encoded); err != nil { | ||
return "", err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add spaces after each if block (this is a convention that we generally follow all over go-git codebase).
I triggered manually the failing job in CI. It is an intermittent failure, not related to this PR. |
Thanks @smola! I'll keep that in mind for some future tagging work I'm working on. |
This adds the ability to sign commits by adding the
SignKey
field toCommitOptions
. If present, the commit will be signed during theWorkTree.Commit
call.The supplied
SignKey
must already be decrypted by the caller.Signed-off-by: Chris Marchesi <[email protected]>
There is also a small bugfix in here as well that was affecting the ability to sign commits: