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

Method TestPackfileIterKeepDescriptors

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

Source from the content-addressed store, hash-verified

368}
369
370func (s *FsSuite) TestPackfileIterKeepDescriptors(c *C) {
371 fixtures.ByTag(".git").Test(c, func(f *fixtures.Fixture) {
372 fs := f.DotGit()
373 ops := dotgit.Options{KeepDescriptors: true}
374 dg := dotgit.NewWithOptions(fs, ops)
375
376 for _, t := range objectTypes {
377 ph, err := dg.ObjectPacks()
378 c.Assert(err, IsNil)
379
380 for _, h := range ph {
381 f, err := dg.ObjectPack(h)
382 c.Assert(err, IsNil)
383
384 idxf, err := dg.ObjectPackIdx(h)
385 c.Assert(err, IsNil)
386
387 iter, err := NewPackfileIter(fs, f, idxf, t, true, 0)
388 c.Assert(err, IsNil)
389
390 err = iter.ForEach(func(o plumbing.EncodedObject) error {
391 c.Assert(o.Type(), Equals, t)
392 return nil
393 })
394 c.Assert(err, IsNil)
395
396 // test twice to check that packfiles are not closed
397 err = iter.ForEach(func(o plumbing.EncodedObject) error {
398 c.Assert(o.Type(), Equals, t)
399 return nil
400 })
401 c.Assert(err, IsNil)
402 }
403 }
404 })
405}
406
407func (s *FsSuite) TestGetFromObjectFileSharedCache(c *C) {
408 f1 := fixtures.ByTag("worktree").One().DotGit()

Callers

nothing calls this directly

Calls 7

NewWithOptionsFunction · 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