diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-16 19:31:55 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-16 20:37:24 +1000 |
commit | 53f06f6a4ecc9ad044c738db72ec96df26626c1e (patch) | |
tree | 39c7380aefb37da76fe20db0ea587d5d02ce1273 /pkg/gui/commits_panel.go | |
parent | c8add47fe747449110c802ef1ac23961bc1ec010 (diff) |
prefill commit reword editor
Diffstat (limited to 'pkg/gui/commits_panel.go')
-rw-r--r-- | pkg/gui/commits_panel.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go index 6aec26ec7..728517b9b 100644 --- a/pkg/gui/commits_panel.go +++ b/pkg/gui/commits_panel.go @@ -216,7 +216,18 @@ func (gui *Gui) handleRenameCommit(g *gocui.Gui, v *gocui.View) error { if gui.State.Panels.Commits.SelectedLine != 0 { return gui.createErrorPanel(gui.Tr.SLocalize("OnlyRenameTopCommit")) } - return gui.prompt(v, gui.Tr.SLocalize("renameCommit"), "", func(response string) error { + + commit := gui.getSelectedCommit() + if commit == nil { + return nil + } + + message, err := gui.GitCommand.GetCommitMessage(commit.Sha) + if err != nil { + return gui.surfaceError(err) + } + + return gui.prompt(v, gui.Tr.SLocalize("renameCommit"), message, func(response string) error { if err := gui.GitCommand.RenameCommit(response); err != nil { return gui.surfaceError(err) } |