(c *C)
| 251 | } |
| 252 | |
| 253 | func (s *TreeSuite) TestTreeDecodeEncodeIdempotent(c *C) { |
| 254 | trees := []*Tree{ |
| 255 | { |
| 256 | Entries: []TreeEntry{ |
| 257 | {"foo", filemode.Regular, plumbing.NewHash("b029517f6300c2da0f4b651b8642506cd6aaf45d")}, |
| 258 | {"bar", filemode.Regular, plumbing.NewHash("c029517f6300c2da0f4b651b8642506cd6aaf45d")}, |
| 259 | {"baz", filemode.Regular, plumbing.NewHash("d029517f6300c2da0f4b651b8642506cd6aaf45d")}, |
| 260 | }, |
| 261 | }, |
| 262 | } |
| 263 | for _, tree := range trees { |
| 264 | sort.Sort(TreeEntrySorter(tree.Entries)) |
| 265 | obj := &plumbing.MemoryObject{} |
| 266 | err := tree.Encode(obj) |
| 267 | c.Assert(err, IsNil) |
| 268 | newTree := &Tree{} |
| 269 | err = newTree.Decode(obj) |
| 270 | c.Assert(err, IsNil) |
| 271 | tree.Hash = obj.Hash() |
| 272 | c.Assert(newTree.Hash, Equals, tree.Hash) |
| 273 | c.Assert(newTree.Entries, DeepEquals, tree.Entries) |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | func (s *TreeSuite) TestTreeDiff(c *C) { |
| 278 | f := fixtures.ByURL("https://github.com/src-d/go-git.git").One() |
nothing calls this directly
no test coverage detected