From 272235925bbe21b5187e58b5c4c6cf156ddf5008 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 22 May 2026 18:16:30 +0200 Subject: [PATCH] Signal ambiguity in the rebase-onto-base-branch label The label currently looks identical in the unambiguous case ("Rebase onto base branch (develop)") and the ambiguous case where develop is just the config-order tiebreak; pressing 'b' would then surprise the user with a picker. Show "pick: main, develop" in the parenthetical when the resolver reports the base is ambiguous so the upcoming prompt is no longer a surprise. The new PickBaseBranchLabel i18n string lives next to the existing PickBaseBranchTitle/Prompt so the disambiguation UI is grouped in one place. --- .../controllers/helpers/merge_and_rebase_helper.go | 14 +++++++++++--- pkg/i18n/english.go | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pkg/gui/controllers/helpers/merge_and_rebase_helper.go b/pkg/gui/controllers/helpers/merge_and_rebase_helper.go index 32553f2a9..b20ed2555 100644 --- a/pkg/gui/controllers/helpers/merge_and_rebase_helper.go +++ b/pkg/gui/controllers/helpers/merge_and_rebase_helper.go @@ -351,10 +351,18 @@ func (self *MergeAndRebaseHelper) RebaseOntoRef(ref string) error { if err != nil { return err } - baseBranchLabel := baseBranch - if baseBranchLabel == "" { + baseBranchLabel := ShortBranchName(baseBranch) + switch { + case baseBranch == "": baseBranchLabel = self.c.Tr.CouldNotDetermineBaseBranch baseBranchDisabledReason = &types.DisabledReason{Text: self.c.Tr.CouldNotDetermineBaseBranch} + case baseAmbiguous: + shortNames := lo.Map(baseCandidates, func(ref string, _ int) string { + return ShortBranchName(ref) + }) + baseBranchLabel = utils.ResolvePlaceholderString(self.c.Tr.PickBaseBranchLabel, + map[string]string{"candidates": strings.Join(shortNames, ", ")}, + ) } menuItems := []*types.MenuItem{ @@ -410,7 +418,7 @@ func (self *MergeAndRebaseHelper) RebaseOntoRef(ref string) error { }, { Label: utils.ResolvePlaceholderString(self.c.Tr.RebaseOntoBaseBranch, - map[string]string{"baseBranch": ShortBranchName(baseBranchLabel)}, + map[string]string{"baseBranch": baseBranchLabel}, ), Keys: menuKey('b'), DisabledReason: baseBranchDisabledReason, diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index e736481cc..4b92a60ad 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -565,6 +565,7 @@ type TranslationSet struct { CouldNotDetermineBaseBranch string PickBaseBranchTitle string PickBaseBranchPrompt string + PickBaseBranchLabel string DivergenceSectionHeaderLocal string DivergenceSectionHeaderRemote string ViewUpstreamResetOptions string @@ -1719,6 +1720,7 @@ func EnglishTranslationSet() *TranslationSet { CouldNotDetermineBaseBranch: "Couldn't determine base branch", PickBaseBranchTitle: "Pick a base branch for {{.branchName}}", PickBaseBranchPrompt: "More than one configured main branch is a candidate for this branch's base. Pick which one to treat as its base.", + PickBaseBranchLabel: "pick: {{.candidates}}", DivergenceSectionHeaderLocal: "Local", DivergenceSectionHeaderRemote: "Remote", ViewUpstreamResetOptions: "Reset checked-out branch onto {{.upstream}}",