(c *C, fs billy.Filesystem, dir *DotGit, f *fixtures.Fixture)
| 469 | } |
| 470 | |
| 471 | func 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 | |
| 495 | func (s *SuiteDotGit) TestObjectPack(c *C) { |
| 496 | f := fixtures.Basic().ByTag(".git").One() |
no test coverage detected