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