fix(copy): bound includeDirs discovery - #191
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughDirectory include patterns now resolve once from the source with bounded matching. Resolved directories are reused for each target worktree. Documentation and tests cover literal, single-wildcard, and recursive patterns. ChangesDirectory copy resolution
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Summary
gtr.copy.includeDirspaths with direct filesystem checks instead of full-treefindwalks**recursivegit gtr copy --alldoes not repeat discovery for every target--allRoot cause
copy_directoriesran an unboundedfindfor every slash-containing pattern and for missing shallow basename patterns.git gtr copy --allrepeated that discovery for each target, multiplying the cost in repositories with large dependency trees or nested worktrees.Literal paths now take the O(1) path and explicitly bounded globs only inspect the depth they can match. Bare basenames retain their legacy recursive fallback when no root match exists, but multiple fallbacks share one full-tree walk.
Validation
shellcheck bin/gtr bin/git-gtr lib/*.sh lib/commands/*.sh adapters/editor/*.sh adapters/ai/*.sh./scripts/generate-completions.sh --check/bin/bash -n lib/copy.sh lib/commands/copy.sh lib/commands/help.shbats tests/copy_safety.bats(46/46)bats tests/cmd_copy.bats(13/13)tests/cmd_clean.bats(456/456)bats tests/against currentmain(490/490)On local macOS, the full suite stops on
cmd_clean --merged uses nested registered worktree path; the same assertion fails on untouchedmainand is unrelated to this change. The full suite passes in GitHub Actions.Closes #189