mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user