Skip to content

Commit 05670ab

Browse files
committed
WIP Menu
1 parent 49701d2 commit 05670ab

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
@@ -324,22 +324,35 @@ func (self *LocalCommitsController) squashDown(selectedCommits []*models.Commit,
324324
}
325325

326326
func (self *LocalCommitsController) fixup(selectedCommits []*models.Commit, startIdx int, endIdx int) error {
327-
if self.isRebasing() {
328-
return self.updateTodos(todo.Fixup, "", selectedCommits)
327+
f := func(flag string) error {
328+
if self.isRebasing() {
329+
return self.updateTodos(todo.Fixup, flag, selectedCommits)
330+
}
331+
332+
return self.c.WithWaitingStatus(self.c.Tr.FixingStatus, func(gocui.Task) error {
333+
self.c.LogAction(self.c.Tr.Actions.FixupCommit)
334+
return self.interactiveRebase(todo.Fixup, flag, startIdx, endIdx)
335+
})
329336
}
330337

331-
self.c.Confirm(types.ConfirmOpts{
338+
return self.c.Menu(types.CreateMenuOptions{
332339
Title: self.c.Tr.Fixup,
333-
Prompt: self.c.Tr.SureFixupThisCommit,
334-
HandleConfirm: func() error {
335-
return self.c.WithWaitingStatus(self.c.Tr.FixingStatus, func(gocui.Task) error {
336-
self.c.LogAction(self.c.Tr.Actions.FixupCommit)
337-
return self.interactiveRebase(todo.Fixup, "", startIdx, endIdx)
338-
})
340+
Prompt: "This squashes the selected commit(s) into the commit below it. You can decide which commit message to keep:",
341+
Items: []*types.MenuItem{
342+
{
343+
Label: "Keep the message of the commit below",
344+
OnPress: func() error {
345+
return f("")
346+
},
347+
},
348+
{
349+
Label: "Keep the message of the first selected commit",
350+
OnPress: func() error {
351+
return f("-C")
352+
},
353+
},
339354
},
340355
})
341-
342-
return nil
343356
}
344357

345358
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
@@ -1256,7 +1255,6 @@ func EnglishTranslationSet() *TranslationSet {
12561255
CannotSquashOrFixupFirstCommit: "There's no commit below to squash into",
12571256
CannotSquashOrFixupMergeCommit: "Cannot squash or fixup a merge commit",
12581257
Fixup: "Fixup",
1259-
SureFixupThisCommit: "Are you sure you want to 'fixup' the selected commit(s) into the commit below?",
12601258
SureSquashThisCommit: "Are you sure you want to squash the selected commit(s) into the commit below?",
12611259
Squash: "Squash",
12621260
SquashMerge: "Squash Merge",

0 commit comments

Comments
 (0)