mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-25 18:55:28 -06:00
Added rebase handler
This commit is contained in:
committed by
Jesse Duffield
parent
670f0e37c7
commit
27994f7de8
@@ -94,6 +94,27 @@ func (gui *Gui) handleBranchesPrevLine(g *gocui.Gui, v *gocui.View) error {
|
||||
|
||||
// specific functions
|
||||
|
||||
func (gui *Gui) handleRebase(g *gocui.Gui, v *gocui.View) error {
|
||||
|
||||
selectedBranch := gui.getSelectedBranch(v).Name
|
||||
checkedOutBranch := gui.State.Branches[0].Name
|
||||
title := "Rebasing"
|
||||
prompt := fmt.Sprintf("Are you sure you want to rebase %s onto %s?", checkedOutBranch, selectedBranch)
|
||||
|
||||
return gui.createConfirmationPanel(g, v, title, prompt,
|
||||
func(g *gocui.Gui, v *gocui.View) error {
|
||||
if selectedBranch == checkedOutBranch {
|
||||
return gui.createErrorPanel(g, gui.Tr.SLocalize("CantRebaseOntoSelf"))
|
||||
}
|
||||
if err := gui.GitCommand.RebaseBranch(selectedBranch); err != nil {
|
||||
gui.createErrorPanel(g, "Failed to rebase")
|
||||
return gui.GitCommand.AbortRebaseBranch()
|
||||
}
|
||||
|
||||
return gui.refreshSidePanels(g)
|
||||
}, nil)
|
||||
}
|
||||
|
||||
func (gui *Gui) handleBranchPress(g *gocui.Gui, v *gocui.View) error {
|
||||
if gui.State.Panels.Branches.SelectedLine == -1 {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user