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, )
| 381 | // DeltaObject returns the object with the given hash, by searching for |
| 382 | // it in the packfile and the git object directories. |
| 383 | func (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 | |
| 402 | func (s *ObjectStorage) getFromUnpacked(h plumbing.Hash) (obj plumbing.EncodedObject, err error) { |
| 403 | f, err := s.dir.Object(h) |
nothing calls this directly
no test coverage detected