The root cause was isExternalBeadsDir() incorrectly identifying bare repo worktrees as "external" repos. This caused bd sync to take the "external beads dir" code path instead of the worktree-based sync branch path. The bug: isExternalBeadsDir() compared syncbranch.GetRepoRoot() (which returns incorrect values for bare repo worktrees) with getRepoRootFromPath() (which uses --show-toplevel). These returned different values for bare repo worktrees, causing local worktrees to be treated as external. The fix: Use git rev-parse --git-common-dir for comparison instead of repo root. This correctly identifies that worktrees of the same repo share the same git directory, regardless of bare repo setup. Also added: - getGitCommonDir() helper function - Tests for both getGitCommonDir and isExternalBeadsDir 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
27 KiB
27 KiB