code: func (s *ObjectStorage) EncodedObject(t plumbing.ObjectType, h plumbing.Hash) (plumbing.EncodedObject, error) {
  	var obj plumbing.EncodedObject
  	var err error
  
  	if s.index != nil {
  		obj, err = s.getFromPackfile(h, false)
  		if err == plumbing.ErrObjectNotFound {
  			obj, err = s.getFromUnpacked(h)
  		}
  	} else {
  		obj, err = s.getFromUnpacked(h)
  		if err == plumbing.ErrObjectNotFound {
  			obj, err = s.getFromPackfile(h, false)
  		}
  	}
  
  	// If the error is still object not found, check if it's a shared object
  	// repository.
  	if err == plumbing.ErrObjectNotFound {
  		dotgits, e := s.dir.Alternates()
  		if e == nil {
  			// Create a new object storage with the DotGit(s) and check for the
  			// required hash object. Skip when not found.
  			for _, dg := range dotgits {
  				o := NewObjectStorage(dg, s.objectCache)
  				enobj, enerr := o.EncodedObject(t, h)
  				if enerr != nil {
  					continue
  				}
  				return enobj, nil
  			}
  		}
  	}
  
  	if err != nil {
  		return nil, err
  	}
  
  	if plumbing.AnyObject != t && obj.Type() != t {
  		return nil, plumbing.ErrObjectNotFound
  	}
  
  	return obj, nil
  }
docs: // EncodedObject returns the object with the given hash, by searching for it in
  // the packfile and the git object directories.