diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/git/GerritGitUtil.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/git/GerritGitUtil.java index 704a7ce9..35d9b0bf 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/git/GerritGitUtil.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/git/GerritGitUtil.java @@ -113,6 +113,11 @@ public Iterable getRepositories(Project project) { public Optional getRepositoryForGerritProject(Project project, String gerritProjectName) { final Iterable repositoriesFromRoots = getRepositories(project); + for (GitRepository repository : repositoriesFromRoots) { + if (repository.getRoot().equals(project.getBaseDir())) { + return Optional.of(repository); + } + } for (GitRepository repository : repositoriesFromRoots) { for (GitRemote remote : repository.getRemotes()) { if (remote.getName().equals(gerritProjectName)) {