diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-17 14:04:57 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-21 22:07:14 +1100 |
commit | dcb52857976762378b0e69bd45581231aa334482 (patch) | |
tree | bb8bd788b151d503f3b3a3cbc93aaeef93bec2b4 /pkg/gui/branches_panel.go | |
parent | a9cd647075119c760ca22cceba8c4ad14687b732 (diff) |
support rebasing onto remote branch
Diffstat (limited to 'pkg/gui/branches_panel.go')
-rw-r--r-- | pkg/gui/branches_panel.go | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index dabe995cb..ca7ca23e8 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -304,23 +304,26 @@ func (gui *Gui) handleMerge(g *gocui.Gui, v *gocui.View) error { return gui.mergeBranchIntoCheckedOutBranch(selectedBranchName) } -func (gui *Gui) handleRebase(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleRebaseOntoLocalBranch(g *gocui.Gui, v *gocui.View) error { + selectedBranchName := gui.getSelectedBranch().Name + return gui.handleRebaseOntoBranch(selectedBranchName) +} + +func (gui *Gui) handleRebaseOntoBranch(selectedBranchName string) error { checkedOutBranch := gui.State.Branches[0].Name - selectedBranch := gui.getSelectedBranch().Name - if selectedBranch == checkedOutBranch { - return gui.createErrorPanel(g, gui.Tr.SLocalize("CantRebaseOntoSelf")) + if selectedBranchName == checkedOutBranch { + return gui.createErrorPanel(gui.g, gui.Tr.SLocalize("CantRebaseOntoSelf")) } prompt := gui.Tr.TemplateLocalize( "ConfirmRebase", Teml{ "checkedOutBranch": checkedOutBranch, - "selectedBranch": selectedBranch, + "selectedBranch": selectedBranchName, }, ) - return gui.createConfirmationPanel(g, v, true, gui.Tr.SLocalize("RebasingTitle"), prompt, + return gui.createConfirmationPanel(gui.g, gui.getBranchesView(), true, gui.Tr.SLocalize("RebasingTitle"), prompt, func(g *gocui.Gui, v *gocui.View) error { - - err := gui.GitCommand.RebaseBranch(selectedBranch) + err := gui.GitCommand.RebaseBranch(selectedBranchName) return gui.handleGenericMergeCommandResult(err) }, nil) } |