mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-13 00:56:25 -04:00
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:
parent
2efaa38124
commit
272235925b
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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}}",
|
||||
|
|
|
|||
Loading…
Reference in a new issue