fix: Auto-configure sync.branch during bd init (bd-flil)

- bd init now auto-sets sync.branch to current git branch
- Fixes 'bd sync --status' error after fresh bd init
- Changed all branch detection to use 'git symbolic-ref' instead of 'git rev-parse' to work in fresh repos without commits
- Updated init.go, init_team.go, sync.go, version.go

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-11-23 19:38:44 -08:00
parent 7e7d1dd702
commit a4c38d53b4
5 changed files with 184 additions and 81 deletions

View File

@@ -210,7 +210,16 @@ With --no-db: creates .beads/ directory and issues.jsonl file instead of SQLite
os.Exit(1)
}
// Set sync.branch if specified
// Set sync.branch: use explicit --branch flag, or auto-detect current branch
// This ensures bd sync --status works after bd init (bd-flil)
if branch == "" && isGitRepo() {
// Auto-detect current branch if not specified
currentBranch, err := getGitBranch()
if err == nil && currentBranch != "" {
branch = currentBranch
}
}
if branch != "" {
if err := syncbranch.Set(ctx, store, branch); err != nil {
fmt.Fprintf(os.Stderr, "Error: failed to set sync branch: %v\n", err)