Program: 111771
Project: 111771
Buggy source:
/** 
 * Checks if file is ignored.
 * @param file current file
 * @return file is ignored
 */
public boolean isFileIgnored(@NotNull final VirtualFile file){
  if (DumbService.isDumb(myProject) || !isEnabled() || !Utils.isUnder(file,myProject.getBaseDir())) {
    return false;
  }
  boolean ignored=false;
  boolean matched=false;
  int valuesCount=0;
  for (  IgnoreFileType fileType : IgnoreFilesIndex.getKeys(myProject)) {
    if (!fileType.getIgnoreLanguage().isEnabled()) {
      continue;
    }
    Collection<IgnoreEntryOccurrence> values=IgnoreFilesIndex.getEntries(myProject,fileType);
    valuesCount+=values.size();
    for (    IgnoreEntryOccurrence value : values) {
      String relativePath;
      if (fileType instanceof GitExcludeFileType) {
        VirtualFile workingDirectory=GitExcludeFileType.getWorkingDirectory(myProject,value.getFile());
        if (workingDirectory == null || !Utils.isUnder(file,workingDirectory)) {
          continue;
        }
        relativePath=StringUtil.trimStart(file.getPath(),workingDirectory.getPath());
      }
 else {
        String parentPath=value.getFile().getParent().getPath();
        if (!StringUtil.startsWith(file.getPath(),parentPath)) {
          if (!ExternalIndexableSetContributor.getAdditionalFiles(myProject).contains(value.getFile())) {
            continue;
          }
        }
        relativePath=StringUtil.trimStart(file.getPath(),parentPath);
      }
      relativePath=StringUtil.trimEnd(StringUtil.trimStart(relativePath,"String_Node_Str"),"String_Node_Str");
      if (StringUtil.isEmpty(relativePath)) {
        continue;
      }
      if (file.isDirectory()) {
        relativePath+="String_Node_Str";
      }
      for (      Pair<Pattern,Boolean> item : value.getItems()) {
        if (item.first.matcher(relativePath).matches()) {
          ignored=!item.second;
          matched=true;
        }
      }
    }
  }
  if (valuesCount > 0 && !ignored && !matched) {
    VirtualFile directory=file.getParent();
    if (directory != null && !directory.equals(myProject.getBaseDir())) {
      return isFileIgnored(directory);
    }
  }
  statusesChangedScheduledFeature.cancel();
  return ignored;
}

Fixed version (ground truth):
/** 
 * Checks if file is ignored.
 * @param file current file
 * @return file is ignored
 */
public boolean isFileIgnored(@NotNull final VirtualFile file){
  if (DumbService.isDumb(myProject) || !isEnabled() || !Utils.isUnder(file,myProject.getBaseDir())) {
    return false;
  }
  boolean ignored=false;
  boolean matched=false;
  int valuesCount=0;
  for (  IgnoreFileType fileType : IgnoreFilesIndex.getKeys(myProject)) {
    if (!fileType.getIgnoreLanguage().isEnabled()) {
      continue;
    }
    Collection<IgnoreEntryOccurrence> values=IgnoreFilesIndex.getEntries(myProject,fileType);
    valuesCount+=values.size();
    for (    IgnoreEntryOccurrence value : values) {
      String relativePath;
      if (fileType instanceof GitExcludeFileType) {
        VirtualFile workingDirectory=GitExcludeFileType.getWorkingDirectory(myProject,value.getFile());
        if (workingDirectory == null || !Utils.isUnder(file,workingDirectory)) {
          continue;
        }
        relativePath=StringUtil.trimStart(file.getPath(),workingDirectory.getPath());
      }
 else {
        String parentPath=value.getFile().getParent().getPath();
        if (!StringUtil.startsWith(file.getPath(),parentPath)) {
          if (!ExternalIndexableSetContributor.getAdditionalFiles(myProject).contains(value.getFile())) {
            continue;
          }
        }
        relativePath=StringUtil.trimStart(file.getPath(),parentPath);
      }
      relativePath=StringUtil.trimEnd(StringUtil.trimStart(relativePath,"String_Node_Str"),"String_Node_Str");
      if (StringUtil.isEmpty(relativePath)) {
        continue;
      }
      if (file.isDirectory()) {
        relativePath+="String_Node_Str";
      }
      for (      Pair<Pattern,Boolean> item : value.getItems()) {
        if (item.first.matcher(relativePath).matches()) {
          ignored=!item.second;
          matched=true;
        }
      }
    }
  }
  if (valuesCount > 0 && !ignored && !matched) {
    VirtualFile directory=file.getParent();
    if (directory != null && !directory.equals(myProject.getBaseDir())) {
      return isFileIgnored(directory);
    }
  }
  if (ignored) {
    statusesChangedScheduledFeature.cancel();
  }
  return ignored;
}