Skip to content

fix(ignore): respect .gitignore with multiple search paths#3417

Open
leno23 wants to merge 1 commit into
BurntSushi:masterfrom
leno23:fix/multi-root-gitignore-3376
Open

fix(ignore): respect .gitignore with multiple search paths#3417
leno23 wants to merge 1 commit into
BurntSushi:masterfrom
leno23:fix/multi-root-gitignore-3376

Conversation

@leno23

@leno23 leno23 commented May 26, 2026

Copy link
Copy Markdown

Summary

When ripgrep is given multiple search paths (e.g. rg pattern src/ tests/), compiled parent-directory ignore matchers were cached keyed only by the parent directory path. Reusing those entries for later search roots could leave a stale absolute_base, causing .gitignore rules to be applied incorrectly.

This change keys the cache by (parent_path, absolute_base_path) and adds a regression test reproducing the order-dependent behavior from the issue.

Fixes #3376

Related: #3320

Test plan

  • cargo test -p ignore multi_root_gitignore_absolute_base
  • cargo test -p ignore

When multiple search paths are provided, reuse of compiled parent
matchers keyed only by parent directory could apply stale absolute_base
values from an earlier root. Include absolute_base in the cache key and
add a regression test.

Fixes BurntSushi#3376

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.gitignore not taken into account when multiple search paths are provided

1 participant