mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 23:56:24 -04:00
Signal ambiguity in the move-commits-to-new-branch label and prompt
Same idea as the rebase and view-divergence labels: when the base is ambiguous, the menu prompt and the "New branch from base branch (...)" item both substitute "pick: main, develop" for the parenthetical so the user knows the disambiguation picker will appear before they pick the "from base" option.
This commit is contained in:
parent
d688fa9319
commit
cee2de60ba
|
|
@ -480,11 +480,19 @@ func (self *RefsHelper) MoveCommitsToNewBranch() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
shortBaseBranchName := ShortBranchName(baseBranchRef)
|
||||
baseBranchLabel := ShortBranchName(baseBranchRef)
|
||||
if 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, ", ")},
|
||||
)
|
||||
}
|
||||
prompt := utils.ResolvePlaceholderString(
|
||||
self.c.Tr.MoveCommitsToNewBranchMenuPrompt,
|
||||
map[string]string{
|
||||
"baseBranchName": shortBaseBranchName,
|
||||
"baseBranchName": baseBranchLabel,
|
||||
},
|
||||
)
|
||||
return self.c.Menu(types.CreateMenuOptions{
|
||||
|
|
@ -492,7 +500,7 @@ func (self *RefsHelper) MoveCommitsToNewBranch() error {
|
|||
Prompt: prompt,
|
||||
Items: []*types.MenuItem{
|
||||
{
|
||||
Label: fmt.Sprintf(self.c.Tr.MoveCommitsToNewBranchFromBaseItem, shortBaseBranchName),
|
||||
Label: fmt.Sprintf(self.c.Tr.MoveCommitsToNewBranchFromBaseItem, baseBranchLabel),
|
||||
OnPress: func() error {
|
||||
moveOff := func(base string) error {
|
||||
return withNewBranchNamePrompt(ShortBranchName(base), func(newBranchName string) error {
|
||||
|
|
|
|||
Loading…
Reference in a new issue