MCPcopy Create free account
hub / github.com/go-git/go-git / testObjectPacks

Function testObjectPacks

storage/filesystem/dotgit/dotgit_test.go:471–493  ·  view source on GitHub ↗
(c *C, fs billy.Filesystem, dir *DotGit, f *fixtures.Fixture)

Source from the content-addressed store, hash-verified

469}
470
471func testObjectPacks(c *C, fs billy.Filesystem, dir *DotGit, f *fixtures.Fixture) {
472 hashes, err := dir.ObjectPacks()
473 c.Assert(err, IsNil)
474 c.Assert(hashes, HasLen, 1)
475 c.Assert(hashes[0], Equals, plumbing.NewHash(f.PackfileHash))
476
477 // Make sure that a random file in the pack directory doesn't
478 // break everything.
479 badFile, err := fs.Create("objects/pack/OOPS_THIS_IS_NOT_RIGHT.pack")
480 c.Assert(err, IsNil)
481 err = badFile.Close()
482 c.Assert(err, IsNil)
483 // temporary file generated by git gc
484 tmpFile, err := fs.Create("objects/pack/.tmp-11111-pack-58rf8y4wm1b1k52bpe0kdlx6lpreg6ahso8n3ylc.pack")
485 c.Assert(err, IsNil)
486 err = tmpFile.Close()
487 c.Assert(err, IsNil)
488
489 hashes2, err := dir.ObjectPacks()
490 c.Assert(err, IsNil)
491 c.Assert(hashes2, HasLen, 1)
492 c.Assert(hashes[0], Equals, hashes2[0])
493}
494
495func (s *SuiteDotGit) TestObjectPack(c *C) {
496 f := fixtures.Basic().ByTag(".git").One()

Callers 2

TestObjectPacksMethod · 0.85

Calls 4

NewHashFunction · 0.92
CreateMethod · 0.80
ObjectPacksMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected