Revert "git: optimize checking if a directory is a Git or Hg root"

Appeared to refresh more than expected. Reverting during investigation.

This reverts commit 86df77cf40.
This commit is contained in:
Kirill Likhodedov
2018-12-13 16:24:30 +03:00
parent 0a7db7eaf0
commit bcfe6c79d1
4 changed files with 2 additions and 20 deletions
@@ -36,13 +36,6 @@ public abstract class VcsRootChecker {
return false;
}
/**
* Checks if the given directory is a root of the supported VCS.
*/
public boolean isRoot(@NotNull VirtualFile maybeRoot) {
return isRoot(maybeRoot.getPath());
}
/**
* Returns the VCS supported by this checker.
*/
@@ -143,8 +143,9 @@ public class VcsRootDetectorImpl implements VcsRootDetector {
@Nullable
private AbstractVcs getVcsFor(@NotNull VirtualFile maybeRoot, @Nullable VirtualFile dirToCheckForIgnore) {
String path = maybeRoot.getPath();
for (VcsRootChecker checker : myCheckers) {
if (checker.isRoot(maybeRoot) && (dirToCheckForIgnore == null || !checker.isIgnored(maybeRoot, dirToCheckForIgnore))) {
if (checker.isRoot(path) && (dirToCheckForIgnore == null || !checker.isIgnored(maybeRoot, dirToCheckForIgnore))) {
return myVcsManager.findVcsByName(checker.getSupportedVcs().getName());
}
}
@@ -39,11 +39,6 @@ public class GitRootChecker extends VcsRootChecker {
return GitUtil.isGitRoot(path);
}
@Override
public boolean isRoot(@NotNull VirtualFile maybeRoot) {
return GitUtil.findGitDir(maybeRoot) != null;
}
@Override
@NotNull
public VcsKey getSupportedVcs() {
@@ -17,8 +17,6 @@ package org.zmlx.hg4idea.roots;
import com.intellij.openapi.vcs.VcsKey;
import com.intellij.openapi.vcs.VcsRootChecker;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.zmlx.hg4idea.HgVcs;
import org.zmlx.hg4idea.util.HgUtil;
@@ -35,11 +33,6 @@ public class HgRootChecker extends VcsRootChecker {
return new File(path, HgUtil.DOT_HG).exists();
}
@Override
public boolean isRoot(@NotNull VirtualFile maybeRoot) {
return VfsUtil.refreshAndFindChild(maybeRoot, HgUtil.DOT_HG) != null;
}
@NotNull
@Override
public VcsKey getSupportedVcs() {