Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore: fix filtering searching subdir or .ignore in parent dir #2933

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

WalterScottYoung
Copy link

@WalterScottYoung WalterScottYoung commented Nov 15, 2024

The previous code deleted too many parts of the path when constructing the absolute path, resulting in a shortened final path. This patch creates the correct absolute path by only removing the necessary parts.

Fixes #2836 and #2747 and #2731

The previous code deleted too many parts of the path when constructing the absolute path, resulting in a shortened final path. This patch creates the correct absolute path by only removing the necessary parts.

Fixes BurntSushi#2836
@WalterScottYoung
Copy link
Author

WalterScottYoung commented Nov 15, 2024

One thing to notice is that commit cad1f5f didn't seems to fully fix #1757, the test in issue 1757 will fail if we add one more directory in the path. I don't know if we should reopen 1757 or something like that to note others about this?

The following test from 1757 with "onemore" directory will fail before this fix.

mkdir tmp
cd tmp
mkdir rust
mkdir -p rust/target/onemore
echo needle > rust/source.rs
echo needle > rust/target/onemore/rustdoc-output.html
echo rust/target/onemore > .ignore
rg --files-with-matches needle
rg --files-with-matches needle rust
echo target >> .ignore
rg --files-with-matches needle rust

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.

Some directories in .ignore aren't ignored
1 participant