Collection<Repository> (@NotNull VcsRepositoryManager vcsRepositoryManager, VirtualFile @Nullable [] files) { if (files == null) return Collections.emptyList(); Collection<Repository> repositories = new HashSet<>(); for (VirtualFile file : files) { Repository repo = vcsRepositoryManager.getRepositoryForFileQuick(file); if (repo != null) { repositories.add(repo); } } return repositories; }