in src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/SubmoduleValidator.java [88:113]
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_CHECK_SUBMODULE,
receiveEvent.pushOptions)) {
try (Repository repo = repoManager.openRepository(receiveEvent.project.getNameKey())) {
List<CommitValidationMessage> messages =
performValidation(repo, receiveEvent.commit, receiveEvent.revWalk);
if (!messages.isEmpty()) {
throw new CommitValidationException("contains submodules", messages);
}
}
}
} catch (NoSuchProjectException | IOException e) {
throw new CommitValidationException("failed to check on submodules", e);
}
return Collections.emptyList();
}