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

@@ -151,7 +151,8 @@ func resolveBranch() string {
}
// Fallback: try to get branch from git at runtime
cmd := exec.Command("git", "rev-parse", "--abbrev-ref", "HEAD")
// Use symbolic-ref to work in fresh repos without commits (bd-flil)
cmd := exec.Command("git", "symbolic-ref", "--short", "HEAD")
cmd.Dir = "."
if output, err := cmd.Output(); err == nil {
if branch := strings.TrimSpace(string(output)); branch != "" && branch != "HEAD" {