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

Method TestPackfileIter

storage/filesystem/object_test.go:289–316  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

287}
288
289func (s *FsSuite) TestPackfileIter(c *C) {
290 fixtures.ByTag(".git").Test(c, func(f *fixtures.Fixture) {
291 fs := f.DotGit()
292 dg := dotgit.New(fs)
293
294 for _, t := range objectTypes {
295 ph, err := dg.ObjectPacks()
296 c.Assert(err, IsNil)
297
298 for _, h := range ph {
299 f, err := dg.ObjectPack(h)
300 c.Assert(err, IsNil)
301
302 idxf, err := dg.ObjectPackIdx(h)
303 c.Assert(err, IsNil)
304
305 iter, err := NewPackfileIter(fs, f, idxf, t, false, 0)
306 c.Assert(err, IsNil)
307
308 err = iter.ForEach(func(o plumbing.EncodedObject) error {
309 c.Assert(o.Type(), Equals, t)
310 return nil
311 })
312 c.Assert(err, IsNil)
313 }
314 }
315 })
316}
317
318func copyFile(c *C, dstDir, dstFilename string, srcFile billy.File) {
319 _, err := srcFile.Seek(0, 0)

Callers

nothing calls this directly

Calls 7

NewFunction · 0.92
NewPackfileIterFunction · 0.85
ObjectPackMethod · 0.80
ObjectPackIdxMethod · 0.80
ObjectPacksMethod · 0.65
ForEachMethod · 0.65
TypeMethod · 0.65

Tested by

no test coverage detected