From 8942261a123d2fa5761f301945d32ba7fffdaab0 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Sat, 10 Jan 2026 21:26:02 -0800 Subject: [PATCH] fix: skip beads restore when directory is redirected (bd-lmqhe) When a repo has a .beads/redirect file pointing to a shared beads directory, restoreBeadsDirFromBranch would fail because it runs git checkout from the local repo but with a path outside that repo. Skip the restore when the beads directory is redirected since the beads dir is managed by a different repo anyway. Fixes: bd-lmqhe Co-Authored-By: Claude Opus 4.5 --- cmd/bd/sync_git.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/bd/sync_git.go b/cmd/bd/sync_git.go index 06eee5a6..1f534dbe 100644 --- a/cmd/bd/sync_git.go +++ b/cmd/bd/sync_git.go @@ -455,6 +455,14 @@ func restoreBeadsDirFromBranch(ctx context.Context) error { return fmt.Errorf("no .beads directory found") } + // Skip restore when beads directory is redirected (bd-lmqhe) + // When redirected, the beads directory is in a different repo, so + // git checkout from the current repo won't work for paths outside it. + redirectInfo := beads.GetRedirectInfo() + if redirectInfo.IsRedirected { + return nil + } + // Restore .beads/ from HEAD (current branch's committed state) // Using -- to ensure .beads/ is treated as a path, not a branch name cmd := exec.CommandContext(ctx, "git", "checkout", "HEAD", "--", beadsDir) //nolint:gosec // G204: beadsDir from FindBeadsDir(), not user input