diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2018-08-07 11:22:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-07 11:22:16 +0200 |
commit | 43d17e14b714665ab5bc2ecc220b6740779d733f (patch) | |
tree | f651b47abb65c9e8400e4058552cdb397eb14bbb /plumbing/object/commit_test.go | |
parent | c58d68a56c0e1c0f0d544b6ef88a5ea0e2bdc60d (diff) | |
parent | 8df413fe09e6cb2069a76b6df6715d0e610c8458 (diff) | |
download | go-git-43d17e14b714665ab5bc2ecc220b6740779d733f.tar.gz |
Merge pull request #892 from jfontan/fix/get-pgp-signature
plumbing/object: fix pgp signature encoder/decoder
Diffstat (limited to 'plumbing/object/commit_test.go')
-rw-r--r-- | plumbing/object/commit_test.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/plumbing/object/commit_test.go b/plumbing/object/commit_test.go index 996d481..b5dfbe3 100644 --- a/plumbing/object/commit_test.go +++ b/plumbing/object/commit_test.go @@ -324,6 +324,38 @@ RUysgqjcpT8+iQM1PblGfHR4XAhuOqN5Fx06PSaFZhqvWFezJ28/CLyX5q+oIVk= err = decoded.Decode(encoded) c.Assert(err, IsNil) c.Assert(decoded.PGPSignature, Equals, pgpsignature) + + // signature in author name + + commit.PGPSignature = "" + commit.Author.Name = beginpgp + encoded = &plumbing.MemoryObject{} + decoded = &Commit{} + + err = commit.Encode(encoded) + c.Assert(err, IsNil) + + err = decoded.Decode(encoded) + c.Assert(err, IsNil) + c.Assert(decoded.PGPSignature, Equals, "") + c.Assert(decoded.Author.Name, Equals, beginpgp) + + // broken signature + + commit.PGPSignature = beginpgp + "\n" + + "some\n" + + "trash\n" + + endpgp + + "text\n" + encoded = &plumbing.MemoryObject{} + decoded = &Commit{} + + err = commit.Encode(encoded) + c.Assert(err, IsNil) + + err = decoded.Decode(encoded) + c.Assert(err, IsNil) + c.Assert(decoded.PGPSignature, Equals, commit.PGPSignature) } func (s *SuiteCommit) TestStat(c *C) { |