From a67c3476583e189c99accc244f7f3d465cab5b69 Mon Sep 17 00:00:00 2001 From: Jonatan Dahl Date: Wed, 28 Jan 2026 14:44:29 -0500 Subject: [PATCH] fix: don't suggest stacking base branch onto itself MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When running `stack status` on the base branch (e.g., main), the command would incorrectly offer to add it to a stack with itself as parent. Accepting this created a circular dependency (main → main). Now detects when the current branch is the base branch and shows a helpful message instead of the problematic prompt. Co-Authored-By: Claude Opus 4.5 --- cmd/status.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/status.go b/cmd/status.go index e81b31e..fe84b44 100644 --- a/cmd/status.go +++ b/cmd/status.go @@ -143,6 +143,14 @@ func runStatus(gitClient git.GitClient, githubClient github.GitHubClient) error // Check this BEFORE waiting for PR fetch to avoid long delays if tree == nil { baseBranch := stack.GetBaseBranch(gitClient) + + // Don't offer to add the base branch to a stack - it can't have a parent + if currentBranch == baseBranch { + fmt.Printf("Branch '%s' is the base branch and cannot be part of a stack.\n", ui.Branch(currentBranch)) + fmt.Printf("\nUse '%s' to create a new stack branch.\n", ui.Command("stack new ")) + return nil + } + fmt.Printf("Current branch '%s' is not part of a stack.\n\n", ui.Branch(currentBranch)) fmt.Printf("Add to stack with '%s' as parent? [Y/n] ", ui.Branch(baseBranch))