Skip to content

Commit 8139eb9

Browse files
committed
WIP Menu
1 parent 24cb221 commit 8139eb9

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

pkg/gui/controllers/local_commits_controller.go

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -340,22 +340,35 @@ func (self *LocalCommitsController) squashDown(selectedCommits []*models.Commit,
340340
}
341341

342342
func (self *LocalCommitsController) fixup(selectedCommits []*models.Commit, startIdx int, endIdx int) error {
343-
if self.isRebasing() {
344-
return self.updateTodos(todo.Fixup, "", selectedCommits)
343+
f := func(flag string) error {
344+
if self.isRebasing() {
345+
return self.updateTodos(todo.Fixup, flag, selectedCommits)
346+
}
347+
348+
return self.c.WithWaitingStatus(self.c.Tr.FixingStatus, func(gocui.Task) error {
349+
self.c.LogAction(self.c.Tr.Actions.FixupCommit)
350+
return self.interactiveRebase(todo.Fixup, flag, startIdx, endIdx)
351+
})
345352
}
346353

347-
self.c.Confirm(types.ConfirmOpts{
354+
return self.c.Menu(types.CreateMenuOptions{
348355
Title: self.c.Tr.Fixup,
349-
Prompt: self.c.Tr.SureFixupThisCommit,
350-
HandleConfirm: func() error {
351-
return self.c.WithWaitingStatus(self.c.Tr.FixingStatus, func(gocui.Task) error {
352-
self.c.LogAction(self.c.Tr.Actions.FixupCommit)
353-
return self.interactiveRebase(todo.Fixup, "", startIdx, endIdx)
354-
})
356+
Prompt: "This squashes the selected commit(s) into the commit below it. You can decide which commit message to keep:",
357+
Items: []*types.MenuItem{
358+
{
359+
Label: "Keep the message of the commit below",
360+
OnPress: func() error {
361+
return f("")
362+
},
363+
},
364+
{
365+
Label: "Keep the message of the first selected commit",
366+
OnPress: func() error {
367+
return f("-C")
368+
},
369+
},
355370
},
356371
})
357-
358-
return nil
359372
}
360373

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

pkg/i18n/english.go

Lines changed: 0 additions & 2 deletions
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
@@ -1252,7 +1251,6 @@ func EnglishTranslationSet() *TranslationSet {
12521251
CannotSquashOrFixupFirstCommit: "There's no commit below to squash into",
12531252
CannotSquashOrFixupMergeCommit: "Cannot squash or fixup a merge commit",
12541253
Fixup: "Fixup",
1255-
SureFixupThisCommit: "Are you sure you want to 'fixup' the selected commit(s) into the commit below?",
12561254
SureSquashThisCommit: "Are you sure you want to squash the selected commit(s) into the commit below?",
12571255
Squash: "Squash",
12581256
SquashMerge: "Squash Merge",

0 commit comments

Comments
 (0)