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

Method DeltaObject

storage/filesystem/object.go:383–400  ·  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

381// DeltaObject returns the object with the given hash, by searching for
382// it in the packfile and the git object directories.
383func (s *ObjectStorage) DeltaObject(t plumbing.ObjectType,
384 h plumbing.Hash,
385) (plumbing.EncodedObject, error) {
386 obj, err := s.getFromUnpacked(h)
387 if err == plumbing.ErrObjectNotFound {
388 obj, err = s.getFromPackfile(h, true)
389 }
390
391 if err != nil {
392 return nil, err
393 }
394
395 if plumbing.AnyObject != t && obj.Type() != t {
396 return nil, plumbing.ErrObjectNotFound
397 }
398
399 return obj, nil
400}
401
402func (s *ObjectStorage) getFromUnpacked(h plumbing.Hash) (obj plumbing.EncodedObject, err error) {
403 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