Set<VcsRoot> (@NotNull VirtualFile dirToScan) { if (!VcsRootChecker.EXTENSION_POINT_NAME.hasAnyExtensions()) { return Collections.emptySet(); } Set<VcsRoot> detectedRoots = new HashSet<>(); Map<VirtualFile, Boolean> scannedDirs = new HashMap<>(); detectedRoots.addAll(scanForRootsInsideDir(myProject, dirToScan, null, scannedDirs)); detectedRoots.addAll(scanForRootsAboveDirs(Collections.singletonList(dirToScan), scannedDirs, detectedRoots)); return detectedRoots; }