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