diff options
author | Sunny <me@darkowlzz.space> | 2017-10-30 01:55:06 +0530 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-10-29 21:25:06 +0100 |
commit | 50732e34e5304e3a32e87a8937faad4d7b845e50 (patch) | |
tree | 52cf3b516b92146278e6e18abf3a3156ffe9ed0f /plumbing/object/commit_test.go | |
parent | 18132cae3a6456de017bd572e49487e354f35bc2 (diff) | |
download | go-git-50732e34e5304e3a32e87a8937faad4d7b845e50.tar.gz |
Add support for signed commits (#616)
* Add support for signed commits
This change adds `GPGSignature` field to `Commit` object. This is used
to store the signature of the commit, if any.
* Rename gpg to pgp
Diffstat (limited to 'plumbing/object/commit_test.go')
-rw-r--r-- | plumbing/object/commit_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/plumbing/object/commit_test.go b/plumbing/object/commit_test.go index e89302d..2d04e77 100644 --- a/plumbing/object/commit_test.go +++ b/plumbing/object/commit_test.go @@ -232,3 +232,29 @@ func (s *SuiteCommit) TestLongCommitMessageSerialization(c *C) { c.Assert(err, IsNil) c.Assert(decoded.Message, Equals, longMessage) } + +func (s *SuiteCommit) TestPGPSignatureSerialization(c *C) { + encoded := &plumbing.MemoryObject{} + decoded := &Commit{} + commit := *s.Commit + + pgpsignature := `-----BEGIN PGP SIGNATURE----- + +iQEcBAABAgAGBQJTZbQlAAoJEF0+sviABDDrZbQH/09PfE51KPVPlanr6q1v4/Ut +LQxfojUWiLQdg2ESJItkcuweYg+kc3HCyFejeDIBw9dpXt00rY26p05qrpnG+85b +hM1/PswpPLuBSr+oCIDj5GMC2r2iEKsfv2fJbNW8iWAXVLoWZRF8B0MfqX/YTMbm +ecorc4iXzQu7tupRihslbNkfvfciMnSDeSvzCpWAHl7h8Wj6hhqePmLm9lAYqnKp +8S5B/1SSQuEAjRZgI4IexpZoeKGVDptPHxLLS38fozsyi0QyDyzEgJxcJQVMXxVi +RUysgqjcpT8+iQM1PblGfHR4XAhuOqN5Fx06PSaFZhqvWFezJ28/CLyX5q+oIVk= +=EFTF +-----END PGP SIGNATURE----- +` + commit.PGPSignature = pgpsignature + + err := commit.Encode(encoded) + c.Assert(err, IsNil) + + err = decoded.Decode(encoded) + c.Assert(err, IsNil) + c.Assert(decoded.PGPSignature, Equals, pgpsignature) +} |