summaryrefslogtreecommitdiffstats
path: root/pkg/gui/branches_panel.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/gui/branches_panel.go')
-rw-r--r--pkg/gui/branches_panel.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go
index b2e9b1525..49a0f0963 100644
--- a/pkg/gui/branches_panel.go
+++ b/pkg/gui/branches_panel.go
@@ -106,7 +106,7 @@ func (gui *Gui) handleBranchPress(g *gocui.Gui, v *gocui.View) error {
return gui.createErrorPanel(g, gui.Tr.SLocalize("AlreadyCheckedOutBranch"))
}
branch := gui.getSelectedBranch()
- return gui.handleCheckoutRef(branch.Name)
+ return gui.handleCheckoutRef(branch.Name, nil)
}
func (gui *Gui) handleCreatePullRequestPress(g *gocui.Gui, v *gocui.View) error {
@@ -143,7 +143,7 @@ func (gui *Gui) handleForceCheckout(g *gocui.Gui, v *gocui.View) error {
}, nil)
}
-func (gui *Gui) handleCheckoutRef(ref string) error {
+func (gui *Gui) handleCheckoutRef(ref string, onDone func()) error {
if err := gui.GitCommand.Checkout(ref, false); err != nil {
// note, this will only work for english-language git commands. If we force git to use english, and the error isn't this one, then the user will receive an english command they may not understand. I'm not sure what the best solution to this is. Running the command once in english and a second time in the native language is one option
@@ -156,6 +156,9 @@ func (gui *Gui) handleCheckoutRef(ref string) error {
if err := gui.GitCommand.Checkout(ref, false); err != nil {
return gui.createErrorPanel(g, err.Error())
}
+ if onDone != nil {
+ onDone()
+ }
// checkout successful so we select the new branch
gui.State.Panels.Branches.SelectedLine = 0
@@ -175,6 +178,10 @@ func (gui *Gui) handleCheckoutRef(ref string) error {
}
}
+ if onDone != nil {
+ onDone()
+ }
+
gui.State.Panels.Branches.SelectedLine = 0
gui.State.Panels.Commits.SelectedLine = 0
return gui.refreshSidePanels(gui.g)
@@ -182,7 +189,7 @@ func (gui *Gui) handleCheckoutRef(ref string) error {
func (gui *Gui) handleCheckoutByName(g *gocui.Gui, v *gocui.View) error {
return gui.createPromptPanel(g, v, gui.Tr.SLocalize("BranchName")+":", "", func(g *gocui.Gui, v *gocui.View) error {
- return gui.handleCheckoutRef(gui.trimmedContent(v))
+ return gui.handleCheckoutRef(gui.trimmedContent(v), nil)
})
}