Repository navigation
grep: exempt the implicit '.' walk root from --exclude-dir - #242
draarivpatel-ui wants to merge 2 commits into
Conversation
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.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #242 +/- ##
==========================================
+ Coverage 97.12% 98.11% +0.98%
==========================================
Files 6 6
Lines 2227 2229 +2
Branches 241 243 +2
==========================================
+ Hits 2163 2187 +24
+ Misses 64 42 -22
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will not alter performanceWarning uutils has exceeded the Hobby plan limit of 5 active contributors. Upgrade your plan or apply to the open source program by December 8, 2026 to keep using CodSpeed. 1 warning
Comparing Footnotes
|
|
GNU grep testsuite comparison: |
|
|
||
| let mut c = scene.cmd(env!("CARGO_BIN_EXE_grep")); | ||
| c.current_dir(scene.fixtures.plus("flat")) | ||
| .args(&["-r", "--exclude-dir=.*", "grep"]) |
There was a problem hiding this comment.
could you please also cover --exclude-dir=. without an operand? the issue has both cases
it should then find .hidden/h.txt too
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.
|
GNU grep testsuite comparison: |
With
-rand no file operand, GNU grep searches the current directory but never matches that implicit.against--exclude-dir. uutils checked the walk root like any other directory, sogrep -r --exclude-dir='.*' PATTERN(the common idiom for skipping hidden dirs such as.git) excluded the root itself and searched nothing.The walk already knows this case:
strip_rootis set only byprocess_implicit_cwd. The fix skips the exclude-dir test for the depth-0 entry in that case. An explicit.operand is unchanged and is still excludable.Closes #165