in src/main/java/com/googlesource/gerrit/plugins/renameproject/conditions/RenamePreconditions.java [129:140]
private void assertNewRepoNotExists(Project.NameKey key) throws CannotRenameProjectException {
try (Repository repo = repoManager.openRepository(key)) {
if (repo.getObjectDatabase().exists()) {
throw new CannotRenameProjectException(
"A project with this name already exists, choose a different name");
}
} catch (RepositoryNotFoundException ignored) {
// Repo does not exist, safe to ignore the exception
} catch (IOException e) {
throw new CannotRenameProjectException(e);
}
}