Repository navigation
grep: ignore trailing slashes in --exclude-dir - #190
sarankumar1325 wants to merge 2 commits into
Conversation
GNU grep 2.19+ treats --exclude-dir=NAME/ the same as --exclude-dir=NAME, because the match is against the directory's bare name. Strip trailing slashes before compiling the exclude-dir glob. Fixes uutils#166 Signed-off-by: sarankumar1325 <120080287+sarankumar1325@users.noreply.github.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
| } | ||
|
|
||
| #[test] | ||
| fn exclude_dir_ignores_trailing_slashes() { |
There was a problem hiding this comment.
could be added to recursive_with_include_exclude instead of a new fn, no?
…h_include_exclude
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Summary
--exclude-dir=vendor/(andvendor//) previously matched nothing, because the pattern was compared to the directory's bare name. Trailing slashes are now stripped, matching GNU grep.Fixes #166
Test plan
cargo test --test test_grep exclude_dir_ignores_trailing_slashes(fails on main)cargo test --test test_grep recursive_with_include_excludecargo fmt --checkcargo clippy --all-targets -- -D warningsAI assistance: used to draft the patch; I reviewed and verified it against GNU grep 3.11 and the failing test on main.