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.
This commit is contained in:
Stefan Haller 2026-05-22 18:16:30 +02:00
parent 2efaa38124
commit 272235925b
2 changed files with 13 additions and 3 deletions

View file

@ -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,

View file

@ -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}}",