1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Allow rewording the head commit during interactive rebase

This commit is contained in:
Stefan Haller
2023-03-03 19:53:15 +01:00
parent 605bc026a1
commit b24955063c
6 changed files with 106 additions and 2 deletions

View File

@ -229,7 +229,7 @@ func (self *LocalCommitsController) reword(commit *models.Commit) error {
func (self *LocalCommitsController) doRewordEditor() error {
self.c.LogAction(self.c.Tr.Actions.RewordCommit)
if self.context().GetSelectedLineIdx() == 0 {
if self.isHeadCommit() {
return self.c.RunSubprocessAndRefresh(self.os.Cmd.New("git commit --allow-empty --amend --only"))
}
@ -728,3 +728,7 @@ func (self *LocalCommitsController) context() *context.LocalCommitsContext {
func (self *LocalCommitsController) paste() error {
return self.helpers.CherryPick.Paste()
}
func (self *LocalCommitsController) isHeadCommit() bool {
return models.IsHeadCommit(self.model.Commits, self.context().GetSelectedLineIdx())
}