MCPcopy
hub / github.com/go-git/go-git / TestFileIterSubmodule

Method TestFileIterSubmodule

plumbing/object/file_test.go:249–274  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

247}
248
249func (s *FileSuite) TestFileIterSubmodule(c *C) {
250 dotgit := fixtures.ByURL("https://github.com/git-fixtures/submodule.git").One().DotGit()
251 st := filesystem.NewStorage(dotgit, cache.NewObjectLRUDefault())
252
253 hash := plumbing.NewHash("b685400c1f9316f350965a5993d350bc746b0bf4")
254 commit, err := GetCommit(st, hash)
255 c.Assert(err, IsNil)
256
257 tree, err := commit.Tree()
258 c.Assert(err, IsNil)
259
260 expected := []string{
261 ".gitmodules",
262 "README.md",
263 }
264
265 var count int
266 i := tree.Files()
267 i.ForEach(func(f *File) error {
268 c.Assert(f.Name, Equals, expected[count])
269 count++
270 return nil
271 })
272
273 c.Assert(count, Equals, 2)
274}

Callers

nothing calls this directly

Calls 7

NewStorageFunction · 0.92
NewObjectLRUDefaultFunction · 0.92
NewHashFunction · 0.92
GetCommitFunction · 0.85
TreeMethod · 0.65
FilesMethod · 0.65
ForEachMethod · 0.65

Tested by

no test coverage detected