void (@NotNull VirtualFile root, @NotNull Map<VirtualFile, Boolean> scannedDirs, @NotNull Set<? super VirtualFile> skipDirs, @NotNull Set<? super VcsRoot> result) { Pattern ignorePattern = VcsRootScanner.parseDirIgnorePattern(); if (VcsRootScanner.isUnderIgnoredDirectory(myProject, ignorePattern, root)) { return; } VirtualFile parent = root.isDirectory() ? root : root.getParent(); while (parent != null) { // do not check same directory twice. // NB: we ignore differences in 'dirToCheckForIgnore' here and might miss some roots, that ignore one content root but not the other. if (!skipDirs.add(parent)) return; if (scannedDirs.get(parent) == Boolean.TRUE) return; if (!scannedDirs.containsKey(parent)) { VcsRoot vcsRoot = getVcsRootFor(parent, root); scannedDirs.put(parent, vcsRoot != null); if (vcsRoot != null) { LOG.debug("Found VCS ", vcsRoot.getVcs(), " in ", vcsRoot.getPath(), " above ", root); result.add(vcsRoot); return; } } parent = parent.getParent(); } }