package com.intellij.openapi.vcs.impl;

import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.roots.impl.DirectoryIndex;
import com.intellij.openapi.vfs.VirtualFile;

/**
 * @author yole
 */
public class ProjectExcludedFileIndex extends ExcludedFileIndex {
  private ProjectRootManager myRootManager;
  private DirectoryIndex myDirectoryIndex;

  public ProjectExcludedFileIndex(final ProjectRootManager rootManager, final DirectoryIndex directoryIndex) {
    myRootManager = rootManager;
    myDirectoryIndex = directoryIndex;
  }

  public boolean isInContent(final VirtualFile file) {
    return myRootManager.getFileIndex().isInContent(file);
  }

  public boolean isExcludedFile(final VirtualFile file) {
    return myRootManager.getFileIndex().isIgnored(file);
  }

  public boolean isValidAncestor(final VirtualFile baseDir, VirtualFile childDir) {
    while (true) {
      if (childDir == null) return false;
      if (myDirectoryIndex.getInfoForDirectory(childDir) == null) return false;
      if (childDir.equals(baseDir)) return true;
      childDir = childDir.getParent();
    }
  }
}
@@ -930,32 +930,81 @@
 ) return false;%0A
+      if (childDir.equals(baseDir)) return true;%0A
       if (myDire
@@ -1071,57 +1071,8 @@
 se;%0A
-      if (childDir.equals(baseDir)) return true;%0A
     

fix CommittedChangesCacheTest