MCPcopy Index your code
hub / github.com/go-git/go-git / TestGetFromObjectFileSharedCache

Method TestGetFromObjectFileSharedCache

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

Source from the content-addressed store, hash-verified

405}
406
407func (s *FsSuite) TestGetFromObjectFileSharedCache(c *C) {
408 f1 := fixtures.ByTag("worktree").One().DotGit()
409 f2 := fixtures.ByTag("worktree").ByTag("submodule").One().DotGit()
410
411 ch := cache.NewObjectLRUDefault()
412 o1 := NewObjectStorage(dotgit.New(f1), ch)
413 o2 := NewObjectStorage(dotgit.New(f2), ch)
414
415 expected := plumbing.NewHash("af2d6a6954d532f8ffb47615169c8fdf9d383a1a")
416 obj, err := o1.EncodedObject(plumbing.CommitObject, expected)
417 c.Assert(err, IsNil)
418 c.Assert(obj.Hash(), Equals, expected)
419
420 _, err = o2.EncodedObject(plumbing.CommitObject, expected)
421 c.Assert(err, Equals, plumbing.ErrObjectNotFound)
422}
423
424func (s *FsSuite) TestHashesWithPrefix(c *C) {
425 // Same setup as TestGetFromObjectFile.

Callers

nothing calls this directly

Calls 6

EncodedObjectMethod · 0.95
NewObjectLRUDefaultFunction · 0.92
NewFunction · 0.92
NewHashFunction · 0.92
NewObjectStorageFunction · 0.70
HashMethod · 0.65

Tested by

no test coverage detected