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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user