code: public static void validateRemoteRefUpdates(String errorPrefix, Collection<RemoteRefUpdate> refUpdates) {
                  for (RemoteRefUpdate refUpdate : refUpdates) {
                          RemoteRefUpdate.Status status = refUpdate.getStatus();
  
                          if (status == RemoteRefUpdate.Status.REJECTED_NODELETE ||
                              status == RemoteRefUpdate.Status.NON_EXISTING ||
                              status == RemoteRefUpdate.Status.NOT_ATTEMPTED ||
                              status == RemoteRefUpdate.Status.REJECTED_NONFASTFORWARD ||
                              status == RemoteRefUpdate.Status.REJECTED_OTHER_REASON ||
                              status == RemoteRefUpdate.Status.REJECTED_REMOTE_CHANGED) {
                                  throw new BuildException(String.format("%s - Status '%s'", errorPrefix, status.name()));
                          }
                  }
          }
docs: Check references updates for any errors
  
  @param errorPrefix The error prefix for any error message
  @param refUpdates A collection of remote references updates