This commit is contained in:
Stefan Haller 2025-04-30 18:36:10 +02:00
parent 24cb221aec
commit 8139eb9c86
2 changed files with 24 additions and 13 deletions

View file

@ -340,22 +340,35 @@ func (self *LocalCommitsController) squashDown(selectedCommits []*models.Commit,
}
func (self *LocalCommitsController) fixup(selectedCommits []*models.Commit, startIdx int, endIdx int) error {
if self.isRebasing() {
return self.updateTodos(todo.Fixup, "", selectedCommits)
f := func(flag string) error {
if self.isRebasing() {
return self.updateTodos(todo.Fixup, flag, selectedCommits)
}
return self.c.WithWaitingStatus(self.c.Tr.FixingStatus, func(gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.FixupCommit)
return self.interactiveRebase(todo.Fixup, flag, startIdx, endIdx)
})
}
self.c.Confirm(types.ConfirmOpts{
return self.c.Menu(types.CreateMenuOptions{
Title: self.c.Tr.Fixup,
Prompt: self.c.Tr.SureFixupThisCommit,
HandleConfirm: func() error {
return self.c.WithWaitingStatus(self.c.Tr.FixingStatus, func(gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.FixupCommit)
return self.interactiveRebase(todo.Fixup, "", startIdx, endIdx)
})
Prompt: "This squashes the selected commit(s) into the commit below it. You can decide which commit message to keep:",
Items: []*types.MenuItem{
{
Label: "Keep the message of the commit below",
OnPress: func() error {
return f("")
},
},
{
Label: "Keep the message of the first selected commit",
OnPress: func() error {
return f("-C")
},
},
},
})
return nil
}
func (self *LocalCommitsController) reword(commit *models.Commit) error {

View file

@ -172,7 +172,6 @@ type TranslationSet struct {
CannotSquashOrFixupMergeCommit string
Fixup string
FixupTooltip string
SureFixupThisCommit string
SureSquashThisCommit string
Squash string
SquashMerge string
@ -1252,7 +1251,6 @@ func EnglishTranslationSet() *TranslationSet {
CannotSquashOrFixupFirstCommit: "There's no commit below to squash into",
CannotSquashOrFixupMergeCommit: "Cannot squash or fixup a merge commit",
Fixup: "Fixup",
SureFixupThisCommit: "Are you sure you want to 'fixup' the selected commit(s) into the commit below?",
SureSquashThisCommit: "Are you sure you want to squash the selected commit(s) into the commit below?",
Squash: "Squash",
SquashMerge: "Squash Merge",