summaryrefslogtreecommitdiffstats
path: root/commits_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2018-06-05 18:49:10 +1000
committerJesse Duffield <jessedduffield@gmail.com>2018-06-05 18:49:10 +1000
commit9c018c61388c0a37b3c8efaf5841debaba1c76fe (patch)
tree318a4e456332e56301a6b022a20146bf1149302d /commits_panel.go
parentd1ead5b0cf4fb400c7d89a6320621f409b999ab5 (diff)
factoring out error panel creation
Diffstat (limited to 'commits_panel.go')
-rw-r--r--commits_panel.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/commits_panel.go b/commits_panel.go
index e70445815..76083374e 100644
--- a/commits_panel.go
+++ b/commits_panel.go
@@ -47,7 +47,7 @@ func handleResetToCommit(g *gocui.Gui, commitView *gocui.View) error {
panic(err)
}
if output, err := gitResetToCommit(commit.Sha); err != nil {
- return createSimpleConfirmationPanel(g, commitView, "Error", output)
+ return createErrorPanel(g, output)
}
if err := refreshCommits(g); err != nil {
panic(err)
@@ -75,17 +75,17 @@ func handleCommitSelect(g *gocui.Gui, v *gocui.View) error {
func handleCommitSquashDown(g *gocui.Gui, v *gocui.View) error {
if getItemPosition(v) != 0 {
- return createSimpleConfirmationPanel(g, v, "Error", "Can only squash topmost commit")
+ return createErrorPanel(g, "Can only squash topmost commit")
}
if len(state.Commits) == 1 {
- return createSimpleConfirmationPanel(g, v, "Error", "You have no commits to squash with")
+ return createErrorPanel(g, "You have no commits to squash with")
}
commit, err := getSelectedCommit(g)
if err != nil {
return err
}
if output, err := gitSquashPreviousTwoCommits(commit.Name); err != nil {
- return createSimpleConfirmationPanel(g, v, "Error", output)
+ return createErrorPanel(g, output)
}
if err := refreshCommits(g); err != nil {
panic(err)
@@ -96,11 +96,11 @@ func handleCommitSquashDown(g *gocui.Gui, v *gocui.View) error {
func handleRenameCommit(g *gocui.Gui, v *gocui.View) error {
if getItemPosition(v) != 0 {
- return createSimpleConfirmationPanel(g, v, "Error", "Can only rename topmost commit")
+ return createErrorPanel(g, "Can only rename topmost commit")
}
createPromptPanel(g, v, "Rename Commit", func(g *gocui.Gui, v *gocui.View) error {
if output, err := gitRenameCommit(v.Buffer()); err != nil {
- return createSimpleConfirmationPanel(g, v, "Error", output)
+ return createErrorPanel(g, output)
}
if err := refreshCommits(g); err != nil {
panic(err)