fix(init): bootstrap from sync-branch when configured (bd-0is)
When sync-branch is configured in config.yaml, bd init now reads from that branch (origin/<branch> first, then local <branch>) instead of HEAD. This ensures fresh clones correctly import issues from the sync branch. Key changes: - checkGitForIssues() now returns gitRef (third return value) - New getLocalSyncBranch() reads sync-branch directly from config.yaml (not cached global config) to handle test environments where CWD changes - importFromGit() accepts gitRef parameter to read from correct branch - Added readFirstIssueFromGit() for prefix auto-detection from git - Fixed macOS symlink issue: filepath.EvalSymlinks() ensures /var and /private/var paths are normalized before filepath.Rel() Part of GitHub issue #464 (beads deletes issues in multi-clone environments) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -250,13 +250,16 @@ func TestCheckGitForIssues_NoGitRepo(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
t.Chdir(tmpDir)
|
||||
|
||||
count, path := checkGitForIssues()
|
||||
count, path, gitRef := checkGitForIssues()
|
||||
if count != 0 {
|
||||
t.Errorf("Expected 0 issues, got %d", count)
|
||||
}
|
||||
if path != "" {
|
||||
t.Errorf("Expected empty path, got %s", path)
|
||||
}
|
||||
if gitRef != "" {
|
||||
t.Errorf("Expected empty gitRef, got %s", gitRef)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCheckGitForIssues_NoBeadsDir(t *testing.T) {
|
||||
@@ -264,7 +267,7 @@ func TestCheckGitForIssues_NoBeadsDir(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
t.Chdir(tmpDir)
|
||||
|
||||
count, path := checkGitForIssues()
|
||||
count, path, _ := checkGitForIssues()
|
||||
if count != 0 || path != "" {
|
||||
t.Logf("No .beads dir: count=%d, path=%s (expected 0, empty)", count, path)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user