fix: bypass external direct-commit when sync.branch is configured (bd-n663)
When .beads/redirect points to another location that crosses directory boundaries, isExternalBeadsDir() can return true even when both paths are in the same git repo. Previously, this would trigger the direct commit mode, bypassing the configured sync.branch workflow. Now we check hasSyncBranchConfig before entering the external path. When sync.branch is configured, we skip direct-commit mode and use the sync.branch worktree workflow instead, which properly handles copying JSONL files regardless of where the source .beads lives. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -305,7 +305,12 @@ Use --merge to merge the sync branch back to main branch.`,
|
||||
beadsDir := filepath.Dir(jsonlPath)
|
||||
isExternal := isExternalBeadsDir(ctx, beadsDir)
|
||||
|
||||
if isExternal {
|
||||
// GH#812/bd-n663: When sync.branch is configured, skip external direct-commit mode.
|
||||
// The redirect may point to another clone/worktree in the same repo, but cross
|
||||
// directory boundaries that trigger isExternalBeadsDir=true. When sync.branch is
|
||||
// configured, we should use the sync.branch workflow which properly handles copying
|
||||
// JSONL files to the sync branch worktree, regardless of where the source .beads lives.
|
||||
if isExternal && !hasSyncBranchConfig {
|
||||
// External BEADS_DIR: commit/pull directly to the beads repo
|
||||
fmt.Println("→ External BEADS_DIR detected, using direct commit...")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user