From 6932e0470812dda75923de75dd1d5183859a0795 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 16 Mar 2024 10:06:53 +0100 Subject: [PATCH] Refresh after creating local branch, before checking it out This way we see the local branch immediately when switching to the branches view, and we see an inline waiting status on it when checking it out. --- pkg/gui/controllers/helpers/refs_helper.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/gui/controllers/helpers/refs_helper.go b/pkg/gui/controllers/helpers/refs_helper.go index dd7ae839a..6ddff118c 100644 --- a/pkg/gui/controllers/helpers/refs_helper.go +++ b/pkg/gui/controllers/helpers/refs_helper.go @@ -144,6 +144,14 @@ func (self *RefsHelper) CheckoutRemoteBranch(fullBranchName string, localBranchN if err := self.c.Git().Branch.CreateWithUpstream(localBranchName, fullBranchName); err != nil { return self.c.Error(err) } + // Do a sync refresh to make sure the new branch is visible, + // so that we see an inline status when checking it out + if err := self.c.Refresh(types.RefreshOptions{ + Mode: types.SYNC, + Scope: []types.RefreshableView{types.BRANCHES}, + }); err != nil { + return err + } return checkout(localBranchName) }, },