(c *C)
| 422 | } |
| 423 | |
| 424 | func (s *FsSuite) TestHashesWithPrefix(c *C) { |
| 425 | // Same setup as TestGetFromObjectFile. |
| 426 | fs := fixtures.ByTag(".git").ByTag("unpacked").One().DotGit() |
| 427 | o := NewObjectStorage(dotgit.New(fs), cache.NewObjectLRUDefault()) |
| 428 | expected := plumbing.NewHash("f3dfe29d268303fc6e1bbce268605fc99573406e") |
| 429 | obj, err := o.EncodedObject(plumbing.AnyObject, expected) |
| 430 | c.Assert(err, IsNil) |
| 431 | c.Assert(obj.Hash(), Equals, expected) |
| 432 | |
| 433 | prefix, _ := hex.DecodeString("f3dfe2") |
| 434 | hashes, err := o.HashesWithPrefix(prefix) |
| 435 | c.Assert(err, IsNil) |
| 436 | c.Assert(hashes, HasLen, 1) |
| 437 | c.Assert(hashes[0].String(), Equals, "f3dfe29d268303fc6e1bbce268605fc99573406e") |
| 438 | } |
| 439 | |
| 440 | func (s *FsSuite) TestHashesWithPrefixFromPackfile(c *C) { |
| 441 | // Same setup as TestGetFromPackfile |
nothing calls this directly
no test coverage detected