fix: resolve main repo root correctly from inside worktrees#126
fix: resolve main repo root correctly from inside worktrees#126
Conversation
discover_repo_root() used git rev-parse --show-toplevel which returns the worktree's own root when called from inside a worktree. Switch to --git-common-dir to always resolve the true main repo root, fixing list, go 1, and all other commands when run from a worktree.
WalkthroughThe pull request fixes incorrect repository root detection when commands are run from inside git worktrees. The Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Comment |
|
@helizaga yay thanks, pls cut a release whenever possible ❤️ |
Summary
Closes #123
discover_repo_root()usedgit rev-parse --show-toplevelwhich returns the worktree's own root when called from inside a worktree, breakinglist,go 1, and all other commandsgit rev-parse --git-common-dirto always resolve the true main repo root (same technique already used by_gtrconfig_path()inlib/config.sh)discover_repo_root,cmd_list, andcmd_gofrom inside a worktreeTest plan
bats tests/core_resolve_target.bats— newdiscover_repo_roottests passbats tests/cmd_list.bats— new from-worktree tests passbats tests/cmd_go.bats— new from-worktree test passesbats tests/— full suite (267 tests) passes with no regressionsSummary by CodeRabbit
Release Notes
Bug Fixes
Tests