MCPcopy Index your code
hub / github.com/go-git/go-git / TestTreeDiff

Method TestTreeDiff

plumbing/object/tree_test.go:277–302  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

275}
276
277func (s *TreeSuite) TestTreeDiff(c *C) {
278 f := fixtures.ByURL("https://github.com/src-d/go-git.git").One()
279 storer := filesystem.NewStorage(f.DotGit(), cache.NewObjectLRUDefault())
280 commit, err := GetCommit(storer, plumbing.NewHash("89f8bda31d29767a6d6ba8f9d0dfb941d598e843"))
281 c.Assert(err, IsNil)
282
283 tree, err := commit.Tree()
284 c.Assert(err, IsNil)
285
286 parentCommit, err := commit.Parent(0)
287 c.Assert(err, IsNil)
288
289 parentTree, err := parentCommit.Tree()
290 c.Assert(err, IsNil)
291
292 ch, err := parentTree.Diff(tree)
293 c.Assert(err, IsNil)
294
295 c.Assert(ch, HasLen, 3)
296 c.Assert(ch[0].From.Name, Equals, "examples/object_storage/main.go")
297 c.Assert(ch[0].To.Name, Equals, "examples/storage/main.go")
298
299 ch, err = parentTree.DiffContext(context.Background(), tree)
300 c.Assert(err, IsNil)
301 c.Assert(ch, HasLen, 3)
302}
303
304func (s *TreeSuite) TestTreeIter(c *C) {
305 encIter, err := s.Storer.IterEncodedObjects(plumbing.TreeObject)

Callers

nothing calls this directly

Calls 8

NewStorageFunction · 0.92
NewObjectLRUDefaultFunction · 0.92
NewHashFunction · 0.92
GetCommitFunction · 0.85
ParentMethod · 0.80
DiffMethod · 0.80
DiffContextMethod · 0.80
TreeMethod · 0.65

Tested by

no test coverage detected