vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Parent .gitignore is ignored when outside of "files to include"

Open thany opened this issue 7 months ago • 1 comments

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.100.2
  • OS Version: Windows 10

Steps to Reproduce:

  1. Have a project with a structure like below
  2. Use the Search feature
  3. Enter /apps/app1 in "files to include"
  4. Notice how it search within files that ought to be ignored

Project structure

(root)
  apps
    app1
      .build
        someignoredfile.txt
      somefile.txt
  .gitignore

Above, in the .gitignore is specified to ignore .build.

So effectively, any .gitignore that lies "above" whatever you fill in at "files to include", is not taken into consideration. In reality though, a parent .gitignore should still apply, as it is still part of the project.

For context, this is especially troublesome in monorepos that have one root-level .gitignore, and you only need to search within one of the projects contained within that monorepo. But of course, it's not limited or exclusive to monorepos.

thany avatar May 23 '25 14:05 thany

See https://github.com/microsoft/vscode/issues/249617

albertosantini avatar May 23 '25 15:05 albertosantini

Closing in favor of https://github.com/microsoft/vscode/issues/249617

osortega avatar Jun 02 '25 17:06 osortega