code: func (s *ObjectStorage) HasEncodedObject(h plumbing.Hash) (err error) {
  	// Check unpacked objects
  	f, err := s.dir.Object(h)
  	if err != nil {
  		if !os.IsNotExist(err) {
  			return err
  		}
  		// Fall through to check packed objects.
  	} else {
  		defer ioutil.CheckClose(f, &err)
  		return nil
  	}
  
  	// Check packed objects.
  	if err := s.requireIndex(); err != nil {
  		return err
  	}
  	_, _, offset := s.findObjectInPackfile(h)
  	if offset == -1 {
  		return plumbing.ErrObjectNotFound
  	}
  	return nil
  }
docs: // HasEncodedObject returns nil if the object exists, without actually
  // reading the object data from storage.