Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: add --override-ignore flag to selectively bypass .gitignore rules#1886

Open
benodiwal wants to merge 1 commit intosharkdp:masterfrom
benodiwal:feature/override-ignore
Open

feat: add --override-ignore flag to selectively bypass .gitignore rules#1886
benodiwal wants to merge 1 commit intosharkdp:masterfrom
benodiwal:feature/override-ignore

Conversation

@benodiwal
Copy link

Closes #1885

@benodiwal benodiwal force-pushed the feature/override-ignore branch from ae7eed7 to e2f504e Compare February 17, 2026 21:51
@tmccombs
Copy link
Collaborator

This looks like it adds a lot of complexity for a fairly niche feature.

Is there a reason we can't just use WalkBuilder::override for this?

@benodiwal
Copy link
Author

I initially tried using WalkBuilder::overrides for this, but the ignore crate's Override::matched() has an implicit blacklist behavior that prevents it.

When you add any whitelist pattern to OverrideBuilder, every non-matching file is force-excluded (Match::Ignore) instead of falling through (Match::None). So for example whitelisting node_modules would hide every other file in the tree. There's no flag to disable this it's hardcoded.

The two-walk approach avoids this by keeping Walk 1 completely unchanged and only running Walk 2 when --override-ignore is actually used, so there's zero cost for normal usage.

Open to simpler approaches if I'm missing something!

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.

--override-ignore flag to selectively bypass .gitignore

2 participants