diff options
author | Filip Navara <filip.navara@gmail.com> | 2019-04-26 10:07:59 +0200 |
---|---|---|
committer | Filip Navara <filip.navara@gmail.com> | 2019-04-26 10:07:59 +0200 |
commit | 14c17dc6881fccf851c8bdffab15774faa3bce8b (patch) | |
tree | e4e567231fee000bf6a6424577c60ce907431a18 /plumbing/object/commit_test.go | |
parent | 34cb7a3aededd002881504dd729527628e923fc6 (diff) | |
parent | ca5d7bb1a790303d2ca245cb6225850bcf5d12a6 (diff) | |
download | go-git-14c17dc6881fccf851c8bdffab15774faa3bce8b.tar.gz |
Merge branch 'master' into commitgraph-obj
Diffstat (limited to 'plumbing/object/commit_test.go')
-rw-r--r-- | plumbing/object/commit_test.go | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/plumbing/object/commit_test.go b/plumbing/object/commit_test.go index c9acf42..957e7d6 100644 --- a/plumbing/object/commit_test.go +++ b/plumbing/object/commit_test.go @@ -4,14 +4,15 @@ import ( "bytes" "context" "io" + "io/ioutil" "strings" "time" + fixtures "gopkg.in/src-d/go-git-fixtures.v3" "gopkg.in/src-d/go-git.v4/plumbing" "gopkg.in/src-d/go-git.v4/plumbing/cache" . "gopkg.in/check.v1" - "gopkg.in/src-d/go-git-fixtures.v3" "gopkg.in/src-d/go-git.v4/storage/filesystem" ) @@ -495,3 +496,23 @@ func (s *SuiteCommit) TestMalformedHeader(c *C) { err = decoded.Decode(encoded) c.Assert(err, IsNil) } + +func (s *SuiteCommit) TestEncodeWithoutSignature(c *C) { + //Similar to TestString since no signature + encoded := &plumbing.MemoryObject{} + err := s.Commit.EncodeWithoutSignature(encoded) + c.Assert(err, IsNil) + er, err := encoded.Reader() + c.Assert(err, IsNil) + payload, err := ioutil.ReadAll(er) + c.Assert(err, IsNil) + + c.Assert(string(payload), Equals, ""+ + "tree eba74343e2f15d62adedfd8c883ee0262b5c8021\n"+ + "parent 35e85108805c84807bc66a02d91535e1e24b38b9\n"+ + "parent a5b8b09e2f8fcb0bb99d3ccb0958157b40890d69\n"+ + "author Máximo Cuadros Ortiz <mcuadros@gmail.com> 1427802494 +0200\n"+ + "committer Máximo Cuadros Ortiz <mcuadros@gmail.com> 1427802494 +0200\n"+ + "\n"+ + "Merge branch 'master' of github.com:tyba/git-fixture\n") +} |