File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -331,10 +331,15 @@ copy_directories() {
331331 # Find directories matching the pattern
332332 # Use -path for patterns with slashes (e.g., vendor/bundle), -name for basenames
333333 # Note: case inside $() inside heredocs breaks Bash 3.2, so compute first
334+ # Use -maxdepth 1 for simple basenames to avoid scanning entire repo (e.g., node_modules)
335+ # Falls back to recursive search if shallow search finds nothing
334336 local find_results
335337 case " $pattern " in
336- * /* ) find_results=$( find . -type d -path " ./$pattern " 2> /dev/null) ;;
337- * ) find_results=$( find . -type d -name " $pattern " 2> /dev/null) ;;
338+ * /* ) find_results=$( find . -type d -path " ./$pattern " 2> /dev/null || true) ;;
339+ * ) find_results=$( find . -maxdepth 1 -type d -name " $pattern " 2> /dev/null || true)
340+ if [ -z " $find_results " ]; then
341+ find_results=$( find . -type d -name " $pattern " 2> /dev/null || true)
342+ fi ;;
338343 esac
339344
340345 while IFS= read -r dir_path; do
You can’t perform that action at this time.
0 commit comments