Set<VcsRoot> (@NotNull Project project, @NotNull VirtualFile root, @Nullable Set<? extends VirtualFile> skipDirs, @NotNull Map<VirtualFile, Boolean> scannedDirs) { Set<VcsRoot> result = new HashSet<>(); VcsRootScanner.visitDirsRecursivelyWithoutExcluded(project, root, false, dir -> { if (skipDirs != null && skipDirs.contains(dir)) { return SKIP_CHILDREN; } if (scannedDirs.containsKey(dir)) return CONTINUE; VcsRoot vcsRoot = getVcsRootFor(dir, null); scannedDirs.put(dir, vcsRoot != null); if (vcsRoot != null) { LOG.debug("Found VCS ", vcsRoot.getVcs(), " in ", vcsRoot.getPath(), " under ", root); result.add(vcsRoot); } return CONTINUE; }); return result; }