fix: validate sync.branch in team wizard and migrate commands (GH#923)
Two code paths bypassed syncbranch.ValidateSyncBranchName(), allowing main/master to be set as sync.branch and causing worktree conflicts. Now both use syncbranch.Set() for proper validation. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Steve Yegge
parent
40ae598751
commit
b420018b97
@@ -10,6 +10,7 @@ import (
|
|||||||
|
|
||||||
"github.com/steveyegge/beads/internal/config"
|
"github.com/steveyegge/beads/internal/config"
|
||||||
"github.com/steveyegge/beads/internal/storage"
|
"github.com/steveyegge/beads/internal/storage"
|
||||||
|
"github.com/steveyegge/beads/internal/syncbranch"
|
||||||
"github.com/steveyegge/beads/internal/ui"
|
"github.com/steveyegge/beads/internal/ui"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,8 +72,8 @@ func runTeamWizard(ctx context.Context, store storage.Storage) error {
|
|||||||
|
|
||||||
fmt.Printf("\n%s Sync branch set to: %s\n", ui.RenderPass("✓"), syncBranch)
|
fmt.Printf("\n%s Sync branch set to: %s\n", ui.RenderPass("✓"), syncBranch)
|
||||||
|
|
||||||
// Set sync.branch config
|
// Set sync.branch config (GH#923: use syncbranch.Set for validation)
|
||||||
if err := store.SetConfig(ctx, "sync.branch", syncBranch); err != nil {
|
if err := syncbranch.Set(ctx, store, syncBranch); err != nil {
|
||||||
return fmt.Errorf("failed to set sync branch: %w", err)
|
return fmt.Errorf("failed to set sync branch: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import (
|
|||||||
"github.com/steveyegge/beads/internal/beads"
|
"github.com/steveyegge/beads/internal/beads"
|
||||||
"github.com/steveyegge/beads/internal/configfile"
|
"github.com/steveyegge/beads/internal/configfile"
|
||||||
"github.com/steveyegge/beads/internal/storage/sqlite"
|
"github.com/steveyegge/beads/internal/storage/sqlite"
|
||||||
|
"github.com/steveyegge/beads/internal/syncbranch"
|
||||||
"github.com/steveyegge/beads/internal/types"
|
"github.com/steveyegge/beads/internal/types"
|
||||||
"github.com/steveyegge/beads/internal/ui"
|
"github.com/steveyegge/beads/internal/ui"
|
||||||
"github.com/steveyegge/beads/internal/utils"
|
"github.com/steveyegge/beads/internal/utils"
|
||||||
@@ -933,8 +934,8 @@ func handleToSeparateBranch(branch string, dryRun bool) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update sync.branch config
|
// Update sync.branch config (GH#923: use syncbranch.Set for validation)
|
||||||
if err := store.SetConfig(ctx, "sync.branch", b); err != nil {
|
if err := syncbranch.Set(ctx, store, b); err != nil {
|
||||||
if jsonOutput {
|
if jsonOutput {
|
||||||
outputJSON(map[string]interface{}{
|
outputJSON(map[string]interface{}{
|
||||||
"error": "config_update_failed",
|
"error": "config_update_failed",
|
||||||
|
|||||||
Reference in New Issue
Block a user