Collection<GitRepository> (@NotNull GitRepositoryManager repositoryManager, @NotNull Collection<? extends VirtualFile> roots) { Collection<GitRepository> repositories = new ArrayList<>(roots.size()); for (VirtualFile root : roots) { GitRepository repo = repositoryManager.getRepositoryForRoot(root); if (repo == null) { LOG.error("Repository not found for root " + root); } else { repositories.add(repo); } } return repositories; }