summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-08-25 19:24:14 +1000
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2020-08-25 09:25:17 +0000
commitf5c55f066b72b3c2445b69aa359fa3fef7c8fd24 (patch)
tree19d49985f7e46720bf4c564001dd6a49d4d839da
parentbd8f198bebca288b7fa5ce9003cd85ec28908550 (diff)
use new branch logic when 'checking out' remote branch
-rw-r--r--pkg/gui/keybindings.go9
-rw-r--r--pkg/gui/remote_branches_panel.go11
2 files changed, 5 insertions, 15 deletions
diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go
index 1582e796b..19b576c06 100644
--- a/pkg/gui/keybindings.go
+++ b/pkg/gui/keybindings.go
@@ -1423,10 +1423,11 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
Description: gui.Tr.SLocalize("editRemote"),
},
{
- ViewName: "branches",
- Contexts: []string{REMOTE_BRANCHES_CONTEXT_KEY},
- Key: gui.getKey("universal.select"),
- Handler: gui.handleCheckoutRemoteBranch,
+ ViewName: "branches",
+ Contexts: []string{REMOTE_BRANCHES_CONTEXT_KEY},
+ Key: gui.getKey("universal.select"),
+ // gonna use the exact same handler as the 'n' keybinding because everybody wants this to happen when they checkout a remote branch
+ Handler: gui.wrappedHandler(gui.handleNewBranchOffCurrentItem),
Description: gui.Tr.SLocalize("checkout"),
},
{
diff --git a/pkg/gui/remote_branches_panel.go b/pkg/gui/remote_branches_panel.go
index 2e7cbf73c..aec02b4c0 100644
--- a/pkg/gui/remote_branches_panel.go
+++ b/pkg/gui/remote_branches_panel.go
@@ -42,17 +42,6 @@ func (gui *Gui) handleRemoteBranchesEscape(g *gocui.Gui, v *gocui.View) error {
return gui.switchContext(gui.Contexts.Remotes.Context)
}
-func (gui *Gui) handleCheckoutRemoteBranch(g *gocui.Gui, v *gocui.View) error {
- remoteBranch := gui.getSelectedRemoteBranch()
- if remoteBranch == nil {
- return nil
- }
- if err := gui.handleCheckoutRef(remoteBranch.FullName(), handleCheckoutRefOptions{}); err != nil {
- return err
- }
- return gui.switchContext(gui.Contexts.Branches.Context)
-}
-
func (gui *Gui) handleMergeRemoteBranch(g *gocui.Gui, v *gocui.View) error {
selectedBranchName := gui.getSelectedRemoteBranch().FullName()
return gui.mergeBranchIntoCheckedOutBranch(selectedBranchName)