When BEADS_DIR environment variable points to a separate git repository, bd sync previously failed with "fatal: 'main' is already used by worktree" because it computed repoRoot from cwd instead of the beads directory. This fix detects when beads dir is in a different git repo than cwd and uses direct git operations (add/commit/push/pull) instead of worktree-based sync, bypassing the problematic worktree creation entirely. Cherry-picked from PR #533 (cleaned up unrelated changes). Co-Authored-By: dand-oss <dand-oss@users.noreply.github.com>
68 KiB
68 KiB