diff options
Diffstat (limited to 'internal/api/stories.go')
| -rw-r--r-- | internal/api/stories.go | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/internal/api/stories.go b/internal/api/stories.go index 640bb0e..2f26040 100644 --- a/internal/api/stories.go +++ b/internal/api/stories.go @@ -14,20 +14,14 @@ import ( "github.com/thepeterstone/claudomator/internal/task" ) -// createStoryBranch creates a new git branch in localPath from origin/master (or main) +// createStoryBranch creates a new git branch in localPath from origin/main // and pushes it to origin. Idempotent: treats "already exists" as success. func createStoryBranch(localPath, branchName string) error { - // Fetch latest from origin so origin/master is up to date. + // Fetch latest from origin so origin/main is up to date. if out, err := exec.Command("git", "-C", localPath, "fetch", "origin").CombinedOutput(); err != nil { return fmt.Errorf("git fetch: %w (output: %s)", err, string(out)) } - // Try to create branch from origin/master; fall back to origin/main. - base := "origin/master" - if out, err := exec.Command("git", "-C", localPath, "rev-parse", "--verify", "origin/master").CombinedOutput(); err != nil { - if strings.Contains(string(out), "fatal") || err != nil { - base = "origin/main" - } - } + base := "origin/main" out, err := exec.Command("git", "-C", localPath, "checkout", "-b", branchName, base).CombinedOutput() if err != nil { if !strings.Contains(string(out), "already exists") { |
