boolean (final FilePath path) { if (myProject.isDisposed()) return false; final VcsRoot rootObject = myVcsManager.getVcsRootObjectFor(path); if (rootObject == null || rootObject.getVcs() != myVcs) { return false; } final VirtualFile vcsRoot = rootObject.getPath(); boolean pathIsRoot = myAllVcsRoots.contains(path); for (VirtualFile otherRoot : myDirtyDirectoriesRecursively.keySet()) { // since we don't know exact dirty mechanics, maybe we have 3 nested mappings like: // /root -> vcs1, /root/child -> vcs2, /root/child/inner -> vcs1, and we have file /root/child/inner/file, // mapping is detected as vcs1 with root /root/child/inner, but we could possibly have in scope // "affected root" -> /root with scope = /root recursively boolean strict = pathIsRoot && !myVcs.areDirectoriesVersionedItems(); if (VfsUtilCore.isAncestor(otherRoot, vcsRoot, strict)) { RecursiveFilePathSet dirsByRoot = myDirtyDirectoriesRecursively.get(otherRoot); if (dirsByRoot.hasAncestor(path)) { return true; } } } if (!myDirtyFiles.isEmpty()) { if (isInDirtyFiles(path, vcsRoot)) return true; FilePath parent = path.getParentPath(); if (parent != null) { if (pathIsRoot) { if (isInDirtyFiles(parent)) return true; } else { if (isInDirtyFiles(parent, vcsRoot)) return true; } } } return false; }