private @NotNull Collection<VcsRoot> scanForRootsInContentRoots() {
    if (myProject.isDisposed() || !VcsRootChecker.EXTENSION_POINT_NAME.hasAnyExtensions()) {
      return Collections.emptyList();
    }

    List<VirtualFile> contentRoots = ContainerUtil.sorted(DefaultVcsRootPolicy.getInstance(myProject).getDefaultVcsRoots(),
                                                          Comparator.comparing(root -> root.getPath().length()));
    MAPPING_DETECTION_LOG.debug("VcsRootDetectorImpl.scanForRootsInContentRoots - contentRoots", contentRoots);

    Set<VcsRoot> detectedRoots = new HashSet<>();
    Set<VirtualFile> skipDirs = new HashSet<>();
    Map<VirtualFile, Boolean> scannedDirs = new HashMap<>();

    // process the inner content roots first
    for (VirtualFile dir : ContainerUtil.reverse(contentRoots)) {
      detectedRoots.addAll(scanForRootsInsideDir(myProject, dir, skipDirs, scannedDirs));
      skipDirs.add(dir);
    }

    // process the outer content roots first
    detectedRoots.addAll(scanForRootsAboveDirs(contentRoots, scannedDirs, detectedRoots));

    Set<VcsRoot> detectedAndKnownRoots = new HashSet<>(detectedRoots);
    detectedAndKnownRoots.addAll(Arrays.asList(ProjectLevelVcsManager.getInstance(myProject).getAllVcsRoots()));
    detectedRoots.addAll(scanDependentRoots(scannedDirs, detectedAndKnownRoots));

    return detectedRoots;
  }
private @NotNull Collection<VcsRoot> scanForRootsInContentRoots()