diff --git a/internal/worktree/worktree.go b/internal/worktree/worktree.go index a04d130e1..67cd16ba2 100644 --- a/internal/worktree/worktree.go +++ b/internal/worktree/worktree.go @@ -128,7 +128,7 @@ func (m *Manager) Prepare( return "", "", fmt.Errorf("invalid worktree coordinates") } dir = m.Dir(owner, repo, issue) - branch = archieBranch(issue, title, body, labels) + branch = archieBranch(issue, title, labels) if _, statErr := os.Stat(filepath.Join(dir, preparedSentinel)); statErr == nil { if err := m.refresh(ctx, dir, base, branch); err != nil { @@ -644,11 +644,9 @@ func resolveBase(r *git.Repository, base string) (plumbing.Hash, error) { // archieBranch builds a descriptive branch name. Uses conventional // commit prefix (feat/fix/chore/etc.) from the issue title when present, // falls back to labels, then defaults to "feat". -func archieBranch(issue int, title, _ /* body */, labels string) string { - prefix, rest := parseTitlePrefix(title) - if prefix == "" { - prefix = labelPrefix(labels) - } +func archieBranch(issue int, title, labels string) string { + prefix := branchPrefix(title, labels) + _, rest := parseTitlePrefix(title) slug := branchSlug(rest) if slug == "" { return fmt.Sprintf("%s/%d", prefix, issue) diff --git a/internal/worktree/worktree_repair_test.go b/internal/worktree/worktree_repair_test.go index 62a232510..394ead235 100644 --- a/internal/worktree/worktree_repair_test.go +++ b/internal/worktree/worktree_repair_test.go @@ -393,7 +393,7 @@ func TestBranchNamingPrecedence(t *testing.T) { for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { - got := archieBranch(tc.issue, tc.title, "", tc.labels) + got := archieBranch(tc.issue, tc.title, tc.labels) if got != tc.want { t.Errorf("archieBranch(%d, %q, %q) = %q, want %q", tc.issue, tc.title, tc.labels, got, tc.want) } diff --git a/internal/worktree/worktree_test.go b/internal/worktree/worktree_test.go index 1419ecc9d..9a762b7c9 100644 --- a/internal/worktree/worktree_test.go +++ b/internal/worktree/worktree_test.go @@ -618,7 +618,7 @@ func TestBranchNaming(t *testing.T) { for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { - if got := archieBranch(tc.issue, tc.title, "", tc.labels); got != tc.want { + if got := archieBranch(tc.issue, tc.title, tc.labels); got != tc.want { t.Errorf("archieBranch() = %q, want %q", got, tc.want) } })