fix(version): remove git subprocess fallback to prevent contention
Some checks failed
CI / Check version consistency (push) Successful in 5s
CI / Check for .beads changes (push) Has been skipped
CI / Test (ubuntu-latest) (push) Failing after 9m13s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (Windows - smoke) (push) Has been cancelled
CI / Test Nix Flake (push) Has been cancelled
CI / Lint (push) Has been cancelled

Under high concurrency (17+ sessions), each bd version spawning git
processes causes severe contention and timeouts. Remove the runtime
git symbolic-ref fallback - branch info is nice-to-have but not essential.

Fixes: GH#503

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
obsidian
2026-01-24 10:34:30 -08:00
committed by John Ogle
parent a45b441bc5
commit 4d5f211601

View File

@@ -1,11 +1,9 @@
package main
import (
"context"
"fmt"
"os"
"runtime/debug"
"strings"
"github.com/spf13/cobra"
"github.com/steveyegge/beads/internal/beads"
@@ -150,17 +148,10 @@ func resolveBranch() string {
}
}
// Fallback: try to get branch from git at runtime
// Use symbolic-ref to work in fresh repos without commits
// Uses CWD repo context since this shows user's current branch
if rc, err := beads.GetRepoContext(); err == nil {
cmd := rc.GitCmdCWD(context.Background(), "symbolic-ref", "--short", "HEAD")
if output, err := cmd.Output(); err == nil {
if branch := strings.TrimSpace(string(output)); branch != "" && branch != "HEAD" {
return branch
}
}
}
// Note: We intentionally avoid a git subprocess fallback here.
// Under high concurrency (17+ sessions), each bd version spawning git
// processes causes severe contention and timeouts. Branch info is
// nice-to-have but not essential for version output.
return ""
}