diff options
author | Kristijan Husak <husakkristijan@gmail.com> | 2018-10-08 21:19:45 +0200 |
---|---|---|
committer | Kristijan Husak <husakkristijan@gmail.com> | 2018-10-08 21:19:45 +0200 |
commit | 190309e5c1c939b4de5c366b31dea265e78cb4f3 (patch) | |
tree | c3995abad5686f2ddc2e6f64b1c22fc1575101fe /pkg/gui | |
parent | ac65586bd551adbac4c738e01bf8c7b216c16418 (diff) |
Check if there is any commit to amend and use 'A' instead of 'M' as shortcut.
Diffstat (limited to 'pkg/gui')
-rw-r--r-- | pkg/gui/files_panel.go | 5 | ||||
-rw-r--r-- | pkg/gui/keybindings.go | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index b16492dfd..19d7b9342 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -217,6 +217,11 @@ func (gui *Gui) handleAmendCommitPress(g *gocui.Gui, filesView *gocui.View) erro } title := strings.Title(gui.Tr.SLocalize("AmendLastCommit")) question := gui.Tr.SLocalize("SureToAmend") + + if len(gui.State.Commits) == 0 { + return gui.createErrorPanel(g, gui.Tr.SLocalize("NoCommitToAmend")) + } + return gui.createConfirmationPanel(g, filesView, title, question, func(g *gocui.Gui, v *gocui.View) error { lastCommitMsg := gui.State.Commits[0].Name _, err := gui.GitCommand.Commit(lastCommitMsg, true) diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index b242028c6..78271a3f7 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -127,7 +127,7 @@ func (gui *Gui) GetKeybindings() []*Binding { Description: gui.Tr.SLocalize("CommitChanges"), }, { ViewName: "files", - Key: 'M', + Key: 'A', Modifier: gocui.ModNone, Handler: gui.handleAmendCommitPress, Description: gui.Tr.SLocalize("AmendLastCommit"), @@ -188,7 +188,7 @@ func (gui *Gui) GetKeybindings() []*Binding { Description: gui.Tr.SLocalize("stashFiles"), }, { ViewName: "files", - Key: 'A', + Key: 'M', Modifier: gocui.ModNone, Handler: gui.handleAbortMerge, Description: gui.Tr.SLocalize("abortMerge"), |