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

Method TestGetFromObjectFileSharedCache

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

Source from the content-addressed store, hash-verified

373}
374
375func (s *FsSuite) TestGetFromObjectFileSharedCache(c *C) {
376 f1 := fixtures.ByTag("worktree").One().DotGit()
377 f2 := fixtures.ByTag("worktree").ByTag("submodule").One().DotGit()
378
379 ch := cache.NewObjectLRUDefault()
380 o1 := NewObjectStorage(dotgit.New(f1), ch)
381 o2 := NewObjectStorage(dotgit.New(f2), ch)
382
383 expected := plumbing.NewHash("af2d6a6954d532f8ffb47615169c8fdf9d383a1a")
384 obj, err := o1.EncodedObject(plumbing.CommitObject, expected)
385 c.Assert(err, IsNil)
386 c.Assert(obj.Hash(), Equals, expected)
387
388 _, err = o2.EncodedObject(plumbing.CommitObject, expected)
389 c.Assert(err, Equals, plumbing.ErrObjectNotFound)
390}
391
392func (s *FsSuite) TestHashesWithPrefix(c *C) {
393 // 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