code: func (s *ObjectStorage) SetEncodedObject(o plumbing.EncodedObject) (h plumbing.Hash, err error) {
  	if o.Type() == plumbing.OFSDeltaObject || o.Type() == plumbing.REFDeltaObject {
  		return plumbing.ZeroHash, plumbing.ErrInvalidType
  	}
  
  	ow, err := s.dir.NewObject()
  	if err != nil {
  		return plumbing.ZeroHash, err
  	}
  
  	defer ioutil.CheckClose(ow, &err)
  
  	or, err := o.Reader()
  	if err != nil {
  		return plumbing.ZeroHash, err
  	}
  
  	defer ioutil.CheckClose(or, &err)
  
  	if err = ow.WriteHeader(o.Type(), o.Size()); err != nil {
  		return plumbing.ZeroHash, err
  	}
  
  	if _, err = io.Copy(ow, or); err != nil {
  		return plumbing.ZeroHash, err
  	}
  
  	return o.Hash(), err
  }
docs: // SetEncodedObject adds a new object to the storage.