Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/copy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,15 @@ copy_directories() {
# Find directories matching the pattern
# Use -path for patterns with slashes (e.g., vendor/bundle), -name for basenames
# Note: case inside $() inside heredocs breaks Bash 3.2, so compute first
# Use -maxdepth 1 for simple basenames to avoid scanning entire repo (e.g., node_modules)
# Falls back to recursive search if shallow search finds nothing
local find_results
case "$pattern" in
*/*) find_results=$(find . -type d -path "./$pattern" 2>/dev/null) ;;
*) find_results=$(find . -type d -name "$pattern" 2>/dev/null) ;;
*/*) find_results=$(find . -type d -path "./$pattern" 2>/dev/null || true) ;;
*) find_results=$(find . -maxdepth 1 -type d -name "$pattern" 2>/dev/null || true)
if [ -z "$find_results" ]; then
find_results=$(find . -type d -name "$pattern" 2>/dev/null || true)
fi ;;
esac

while IFS= read -r dir_path; do
Expand Down