void (final FilePath newcomer) { final VirtualFile vcsRoot = myVcsManager.getVcsRootFor(newcomer); if (vcsRoot == null) return; myAffectedVcsRoots.add(vcsRoot); for (Map.Entry<VirtualFile, Set<FilePath>> entry : myDirtyFiles.entrySet()) { final VirtualFile groupRoot = entry.getKey(); if (groupRoot != null && VfsUtilCore.isAncestor(vcsRoot, groupRoot, false)) { Set<FilePath> files = entry.getValue(); if (files != null) { for (Iterator<FilePath> it = files.iterator(); it.hasNext(); ) { FilePath oldBoy = it.next(); if (VcsFileUtil.isAncestor(newcomer, oldBoy, false)) { it.remove(); } } } } } RecursiveFilePathSet dirsByRoot = myDirtyDirectoriesRecursively.get(vcsRoot); if (dirsByRoot == null) { dirsByRoot = newRecursiveFilePathSet(); myDirtyDirectoriesRecursively.put(vcsRoot, dirsByRoot); } else { if (dirsByRoot.hasAncestor(newcomer)) return; List<FilePath> toRemove = ContainerUtil.filter(dirsByRoot.filePaths(), oldBoy -> VcsFileUtil.isAncestor(newcomer, oldBoy, false)); for (FilePath path : toRemove) { dirsByRoot.remove(path); } } dirsByRoot.add(newcomer); }