summaryrefslogtreecommitdiffstats
path: root/pkg/gui/files_panel.go
diff options
context:
space:
mode:
authorKristijan Husak <husakkristijan@gmail.com>2018-10-08 21:19:45 +0200
committerKristijan Husak <husakkristijan@gmail.com>2018-10-08 21:19:45 +0200
commit190309e5c1c939b4de5c366b31dea265e78cb4f3 (patch)
treec3995abad5686f2ddc2e6f64b1c22fc1575101fe /pkg/gui/files_panel.go
parentac65586bd551adbac4c738e01bf8c7b216c16418 (diff)
Check if there is any commit to amend and use 'A' instead of 'M' as shortcut.
Diffstat (limited to 'pkg/gui/files_panel.go')
-rw-r--r--pkg/gui/files_panel.go5
1 files changed, 5 insertions, 0 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)