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

Method DeltaObject

storage/filesystem/object.go:373–389  ·  view source on GitHub ↗

DeltaObject returns the object with the given hash, by searching for it in the packfile and the git object directories.

(t plumbing.ObjectType,
	h plumbing.Hash)

Source from the content-addressed store, hash-verified

371// DeltaObject returns the object with the given hash, by searching for
372// it in the packfile and the git object directories.
373func (s *ObjectStorage) DeltaObject(t plumbing.ObjectType,
374 h plumbing.Hash) (plumbing.EncodedObject, error) {
375 obj, err := s.getFromUnpacked(h)
376 if err == plumbing.ErrObjectNotFound {
377 obj, err = s.getFromPackfile(h, true)
378 }
379
380 if err != nil {
381 return nil, err
382 }
383
384 if plumbing.AnyObject != t && obj.Type() != t {
385 return nil, plumbing.ErrObjectNotFound
386 }
387
388 return obj, nil
389}
390
391func (s *ObjectStorage) getFromUnpacked(h plumbing.Hash) (obj plumbing.EncodedObject, err error) {
392 f, err := s.dir.Object(h)

Callers

nothing calls this directly

Calls 3

getFromUnpackedMethod · 0.95
getFromPackfileMethod · 0.95
TypeMethod · 0.65

Tested by

no test coverage detected