mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-31 23:19:40 +02:00
extenden delete branch with error message and confirmation
This commit is contained in:
parent
48cea4e1c4
commit
bfa47d3b91
@ -51,12 +51,18 @@ func handleNewBranch(g *gocui.Gui, v *gocui.View) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleDeleteBranch(g *gocui.Gui, v *gocui.View) error {
|
func handleDeleteBranch(g *gocui.Gui, v *gocui.View) error {
|
||||||
branch := getSelectedBranch(v)
|
checkedOutBranch := state.Branches[0]
|
||||||
if output, err := gitDeleteBranch(branch.Name); err != nil {
|
selectedBranch := getSelectedBranch(v)
|
||||||
|
if checkedOutBranch.Name == selectedBranch.Name {
|
||||||
|
return createErrorPanel(g, "You cannot delete the checked out branch!")
|
||||||
|
}
|
||||||
|
return createConfirmationPanel(g, v, "Delete Branch", "Are you sure you want delete the branch "+selectedBranch.Name+" ?", func(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
if output, err := gitDeleteBranch(selectedBranch.Name); err != nil {
|
||||||
return createErrorPanel(g, output)
|
return createErrorPanel(g, output)
|
||||||
}
|
}
|
||||||
return refreshSidePanels(g)
|
return refreshSidePanels(g)
|
||||||
|
}, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user