* fix(syncbranch): support bare repos and worktrees with git-common-dir Replace hardcoded .git/beads-worktrees/ path with dynamic detection using git rev-parse --git-common-dir. This correctly handles: - Regular repositories (.git is a directory) - Git worktrees (.git is a file pointing elsewhere) - Bare repositories (no .git directory, repo IS the git dir) - Worktrees of bare repositories The new getBeadsWorktreePath() helper uses git's native API to find the shared git directory, ensuring beads worktrees are created in the correct location regardless of repository structure. Updated functions: - CommitToSyncBranch - PullFromSyncBranch - CheckDivergence - ResetToRemote Fixes #639 * test(syncbranch): add regression tests for getBeadsWorktreePath Add comprehensive tests for the worktree path calculation to ensure proper handling of various repository structures: - Regular repos: uses .git/beads-worktrees path - Bare repos: uses <bare-repo>/beads-worktrees (no .git subdirectory) - Worktrees: uses main repo's .git/beads-worktrees (git-common-dir) - Fallback: legacy behavior when git command fails - Relative paths: ensures absolute path conversion These tests ensure the fix for GH#639 doesn't regress. --------- Co-authored-by: Charles P. Cross <cpdata@users.noreply.github.com>
5.6 KiB
5.6 KiB