Skip to content

[BUG] search_files includes files ignored by nested .gitignore #7921

@hannesrudolph

Description

@hannesrudolph

Type

Bug

Problem

The search_files tool returns results from directories/files that a nested .gitignore marks as ignored.

Context

This occurs when running search_files from the repository root in projects that have .gitignore files inside subdirectories. Users expect ignored paths to be excluded by default, but results from those paths appear, adding noise and increasing output size.

Reproduction

  1. Use a repository that contains a nested .gitignore which ignores a subdirectory (for example, build/, dist/, out/, coverage/, or similar).
  2. Run the search_files tool from the repo root with a broad regex.
  3. Expected result: Matches from ignored paths are excluded by default.
  4. Actual result: Results include matches from the ignored subdirectory.

Constraints/Preferences

  • Respect .gitignore files (including nested ones) by default in search_files.
  • Provide an explicit option to include ignored files only when requested.
  • Optionally show a brief notice when ignored paths were excluded and offer a way to re-run including them.

Metadata

Metadata

Assignees

Labels

Issue - In ProgressSomeone is actively working on this. Should link to a PR soon.bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions