code: func (r *ReferenceStorage) CheckAndSetReference(ref, old *plumbing.Reference) error {
  	if old == nil {
  		return r.SetReference(ref)
  	}
  
  	tmp, err := r.temporal.Reference(old.Name())
  	if err == plumbing.ErrReferenceNotFound {
  		tmp, err = r.ReferenceStorer.Reference(old.Name())
  	}
  
  	if err != nil {
  		return err
  	}
  
  	if tmp.Hash() != old.Hash() {
  		return storage.ErrReferenceHasChanged
  	}
  
  	return r.SetReference(ref)
  }
docs: // SetReference honors the storer.ReferenceStorer interface.