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.
This commit is contained in:
Stefan Haller 2024-03-16 10:06:53 +01:00
parent 30db7234d9
commit 6932e04708

View file

@ -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)
},
},