private @Nullable VcsRoot detectVcsRootBy(@NotNull VirtualFile maybeRoot,
                                            @Nullable VirtualFile dirToCheckForIgnore,
                                            @NotNull VcsRootChecker checker) {
    if (!maybeRoot.isInLocalFileSystem()) return null;
    if (!checker.isRoot(maybeRoot)) return null;
    if (dirToCheckForIgnore != null && checker.isIgnored(maybeRoot, dirToCheckForIgnore)) return null;

    AbstractVcs vcs = ProjectLevelVcsManager.getInstance(myProject).findVcsByName(checker.getSupportedVcs().getName());
    if (vcs == null) return null;

    return new VcsRoot(vcs, maybeRoot);
  }
private @Nullable VcsRoot detectVcsRootBy(@NotNull VirtualFile maybeRoot,
                                            @Nullable VirtualFile dirToCheckForIgnore,
                                            @NotNull VcsRootChecker checker)