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 { func (self *LocalCommitsController) fixup(selectedCommits []*models.Commit, startIdx int, endIdx int) error {
if self.isRebasing() { f := func(flag string) error {
return self.updateTodos(todo.Fixup, "", selectedCommits) 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, Title: self.c.Tr.Fixup,
Prompt: self.c.Tr.SureFixupThisCommit, Prompt: "This squashes the selected commit(s) into the commit below it. You can decide which commit message to keep:",
HandleConfirm: func() error { Items: []*types.MenuItem{
return self.c.WithWaitingStatus(self.c.Tr.FixingStatus, func(gocui.Task) error { {
self.c.LogAction(self.c.Tr.Actions.FixupCommit) Label: "Keep the message of the commit below",
return self.interactiveRebase(todo.Fixup, "", startIdx, endIdx) 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 { func (self *LocalCommitsController) reword(commit *models.Commit) error {

View file

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