gt done: Require pushed branch before MR creation (gt-bca67)

Add BranchPushedToRemote check before creating MR bead.
Prevents work loss when polecat is nuked with unpushed commits.
This commit is contained in:
gastown/polecats/furiosa
2025-12-30 20:52:52 -08:00
committed by Steve Yegge
parent aed2482d88
commit 6d4e0f0c96

View File

@@ -115,6 +115,16 @@ func runDone(cmd *cobra.Command, args []string) error {
return fmt.Errorf("cannot submit main/master branch to merge queue")
}
// Check for unpushed commits - branch must be pushed before MR creation
// Use BranchPushedToRemote which handles polecat branches without upstream tracking
pushed, unpushedCount, err := g.BranchPushedToRemote(branch, "origin")
if err != nil {
return fmt.Errorf("checking if branch is pushed: %w", err)
}
if !pushed {
return fmt.Errorf("branch has %d unpushed commit(s); run 'git push -u origin %s' first", unpushedCount, branch)
}
if issueID == "" {
return fmt.Errorf("cannot determine source issue from branch '%s'; use --issue to specify", branch)
}