1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

remember the message if commit fails

In case a commit fails, e.g. because a pre-commit hook returns an error,
lazygit will now remember the commit message and will suggest it during
the next commit (e.g. after fixing the error of the pre-commit hook).
This commit is contained in:
Jakob Kogler
2021-12-05 22:33:07 +01:00
committed by Jesse Duffield
parent 0d3e5e6a1d
commit beedc2553d
3 changed files with 22 additions and 11 deletions

View File

@ -10,6 +10,7 @@ import (
func (gui *Gui) handleCommitConfirm() error {
message := strings.TrimSpace(gui.Views.CommitMessage.TextArea.GetContent())
gui.State.messageFailedCommit = message
if message == "" {
return gui.createErrorPanel(gui.Tr.CommitWithoutMessageErr)
}
@ -29,6 +30,7 @@ func (gui *Gui) handleCommitConfirm() error {
_ = gui.returnFromContext()
return gui.withGpgHandling(cmdObj, gui.Tr.CommittingStatus, func() error {
gui.Views.CommitMessage.ClearTextArea()
gui.State.messageFailedCommit = ""
return nil
})
}