Skip to content

Commit ceb940e

Browse files
committed
WIP Menu
1 parent 88e6e1f commit ceb940e

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

pkg/gui/controllers/local_commits_controller.go

+24-11
Original file line numberDiff line numberDiff line change
@@ -332,22 +332,35 @@ func (self *LocalCommitsController) squashDown(selectedCommits []*models.Commit,
332332
}
333333

334334
func (self *LocalCommitsController) fixup(selectedCommits []*models.Commit, startIdx int, endIdx int) error {
335-
if self.isRebasing() {
336-
return self.updateTodos(todo.Fixup, "", selectedCommits)
335+
f := func(flag string) error {
336+
if self.isRebasing() {
337+
return self.updateTodos(todo.Fixup, flag, selectedCommits)
338+
}
339+
340+
return self.c.WithWaitingStatus(self.c.Tr.FixingStatus, func(gocui.Task) error {
341+
self.c.LogAction(self.c.Tr.Actions.FixupCommit)
342+
return self.interactiveRebase(todo.Fixup, flag, startIdx, endIdx)
343+
})
337344
}
338345

339-
self.c.Confirm(types.ConfirmOpts{
346+
return self.c.Menu(types.CreateMenuOptions{
340347
Title: self.c.Tr.Fixup,
341-
Prompt: self.c.Tr.SureFixupThisCommit,
342-
HandleConfirm: func() error {
343-
return self.c.WithWaitingStatus(self.c.Tr.FixingStatus, func(gocui.Task) error {
344-
self.c.LogAction(self.c.Tr.Actions.FixupCommit)
345-
return self.interactiveRebase(todo.Fixup, "", startIdx, endIdx)
346-
})
348+
Prompt: "This squashes the selected commit(s) into the commit below it. You can decide which commit message to keep:",
349+
Items: []*types.MenuItem{
350+
{
351+
Label: "Keep the message of the commit below",
352+
OnPress: func() error {
353+
return f("")
354+
},
355+
},
356+
{
357+
Label: "Keep the message of the first selected commit",
358+
OnPress: func() error {
359+
return f("-C")
360+
},
361+
},
347362
},
348363
})
349-
350-
return nil
351364
}
352365

353366
func (self *LocalCommitsController) reword(commit *models.Commit) error {

pkg/i18n/english.go

-2
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ type TranslationSet struct {
172172
CannotSquashOrFixupMergeCommit string
173173
Fixup string
174174
FixupTooltip string
175-
SureFixupThisCommit string
176175
SureSquashThisCommit string
177176
Squash string
178177
SquashMerge string
@@ -1255,7 +1254,6 @@ func EnglishTranslationSet() *TranslationSet {
12551254
CannotSquashOrFixupFirstCommit: "There's no commit below to squash into",
12561255
CannotSquashOrFixupMergeCommit: "Cannot squash or fixup a merge commit",
12571256
Fixup: "Fixup",
1258-
SureFixupThisCommit: "Are you sure you want to 'fixup' the selected commit(s) into the commit below?",
12591257
SureSquashThisCommit: "Are you sure you want to squash the selected commit(s) into the commit below?",
12601258
Squash: "Squash",
12611259
SquashMerge: "Squash Merge",

0 commit comments

Comments
 (0)