public List onCommitReceived()

in src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/DuplicatePathnameValidator.java [177:203]


  public List<CommitValidationMessage> onCommitReceived(CommitReceivedEvent receiveEvent)
      throws CommitValidationException {
    try {
      PluginConfig cfg =
          cfgFactory.getFromProjectConfigWithInheritance(
              receiveEvent.project.getNameKey(), pluginName);
      if (isActive(cfg)
          && validatorConfig.isEnabled(
              receiveEvent.user,
              receiveEvent.getProjectNameKey(),
              receiveEvent.getRefName(),
              KEY_REJECT_DUPLICATE_PATHNAMES,
              receiveEvent.pushOptions)) {
        locale = getLocale(cfg);
        try (Repository repo = repoManager.openRepository(receiveEvent.project.getNameKey())) {
          List<CommitValidationMessage> messages =
              performValidation(repo, receiveEvent.commit, receiveEvent.revWalk);
          if (!messages.isEmpty()) {
            throw new CommitValidationException("contains duplicate pathnames", messages);
          }
        }
      }
    } catch (NoSuchProjectException | IOException e) {
      throw new CommitValidationException("failed to check for duplicate pathnames", e);
    }
    return Collections.emptyList();
  }