diff options
author | Mark Kopenga <mkopenga@gmail.com> | 2018-10-27 15:06:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-27 15:06:51 +0200 |
commit | 45c249acca0bb4e390f660a896122040510bebd2 (patch) | |
tree | 41816887288a6700a5c80514feebe7168b11ab00 /pkg/gui | |
parent | 1df1053947a2206d85a739208faa383f0735bd7b (diff) | |
parent | c6da4c8a47a45a96beb2de4fbe5b98cfb87446b4 (diff) |
Merge branch 'master' into https-ask-for-username-password
Diffstat (limited to 'pkg/gui')
-rw-r--r-- | pkg/gui/branches_panel.go | 11 | ||||
-rw-r--r-- | pkg/gui/keybindings.go | 6 |
2 files changed, 10 insertions, 7 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index 11a4a0ebb..dbf4b007a 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -87,6 +87,10 @@ func (gui *Gui) deleteBranch(g *gocui.Gui, v *gocui.View, force bool) error { if checkedOutBranch.Name == selectedBranch.Name { return gui.createErrorPanel(g, gui.Tr.SLocalize("CantDeleteCheckOutBranch")) } + return gui.deleteNamedBranch(g, v, selectedBranch, force) +} + +func (gui *Gui) deleteNamedBranch(g *gocui.Gui, v *gocui.View, selectedBranch *commands.Branch, force bool) error { title := gui.Tr.SLocalize("DeleteBranch") var messageId string if force { @@ -102,7 +106,12 @@ func (gui *Gui) deleteBranch(g *gocui.Gui, v *gocui.View, force bool) error { ) return gui.createConfirmationPanel(g, v, title, message, func(g *gocui.Gui, v *gocui.View) error { if err := gui.GitCommand.DeleteBranch(selectedBranch.Name, force); err != nil { - return gui.createErrorPanel(g, err.Error()) + errMessage := err.Error() + if !force && strings.Contains(errMessage, "is not fully merged") { + return gui.deleteNamedBranch(g, v, selectedBranch, true) + } else { + return gui.createErrorPanel(g, errMessage) + } } return gui.refreshSidePanels(g) }, nil) diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 4a8995d5f..e460e4a1c 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -309,12 +309,6 @@ func (gui *Gui) GetKeybindings() []*Binding { Description: gui.Tr.SLocalize("deleteBranch"), }, { ViewName: "branches", - Key: 'D', - Modifier: gocui.ModNone, - Handler: gui.handleForceDeleteBranch, - Description: gui.Tr.SLocalize("forceDeleteBranch"), - }, { - ViewName: "branches", Key: 'm', Modifier: gocui.ModNone, Handler: gui.handleMerge, |