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

Method packfile

storage/filesystem/object.go:217–235  ·  view source on GitHub ↗
(idx idxfile.Index, pack plumbing.Hash)

Source from the content-addressed store, hash-verified

215}
216
217func (s *ObjectStorage) packfile(idx idxfile.Index, pack plumbing.Hash) (*packfile.Packfile, error) {
218 if p := s.packfileFromCache(pack); p != nil {
219 return p, nil
220 }
221
222 f, err := s.dir.ObjectPack(pack)
223 if err != nil {
224 return nil, err
225 }
226
227 var p *packfile.Packfile
228 if s.objectCache != nil {
229 p = packfile.NewPackfileWithCache(idx, s.dir.Fs(), f, s.objectCache, s.options.LargeObjectThreshold)
230 } else {
231 p = packfile.NewPackfile(idx, s.dir.Fs(), f, s.options.LargeObjectThreshold)
232 }
233
234 return p, s.storePackfileInCache(pack, p)
235}
236
237func (s *ObjectStorage) packfileFromCache(hash plumbing.Hash) *packfile.Packfile {
238 if s.packfiles == nil {

Callers 2

getFromPackfileMethod · 0.95

Calls 6

packfileFromCacheMethod · 0.95
storePackfileInCacheMethod · 0.95
NewPackfileWithCacheFunction · 0.92
NewPackfileFunction · 0.92
ObjectPackMethod · 0.80
FsMethod · 0.80

Tested by

no test coverage detected