fix(copy): match root-level files for ** glob patterns on Bash 3.2#133
fix(copy): match root-level files for ** glob patterns on Bash 3.2#133
Conversation
The find -path fallback doesn't treat ** as a recursive glob, so patterns like **/.env* never matched root-level files. Now also searches with the suffix pattern at maxdepth 1 for **/-prefixed patterns. Adds an empty-string guard to prevent cp "" failures when find returns no results. Closes #132
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (2)
WalkthroughThe changes enhance the Bash 3.2 fallback mechanism in the copy utility to correctly handle recursive Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
Summary
**/.env*and similar glob patterns not matching root-level files on macOS (Bash 3.2findfallback)cp ""failures whenfindreturns no resultsRoot Cause
find -pathdoesn't treat**as a recursive glob — it's just a wildcard. The pattern./**/.env*requires a/before.env, so root-level./.envnever matches. Additionally, emptyfindresults still fed one blank line towhile read, causingcp ""to fail.Fix
For
**/-prefixed patterns, also runfind . -maxdepth 1 -path "./$suffix"to catch root-level files. Uses-maxdepth 1to avoid duplicates with the deep search.Test plan
bats tests/copy_safety.bats— 4 new tests covering empty results, root-level, nested, and mixed matchingbats tests/— full suite (276 tests) passesCloses #132
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests