Show the inline status again when checking out a newly created remote branch

Checking out a remote branch that has no local counterpart creates the
local branch, refreshes, and then checks it out. The refresh exists so
that CheckoutRef finds the new branch in the model and attaches an inline
status to the branch item instead of showing a global waiting status. But
since UI-thread refreshes stopped blocking, the checkout started before
the refreshed branches had landed in the model, so the lookup failed and
we always got the waiting status. Run the checkout from the refresh's
Then, which is queued behind the model update.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Stefan Haller 2026-07-21 13:07:03 +02:00
parent 4b3e5f123f
commit 00cef799ce

View file

@ -157,12 +157,17 @@ func (self *RefsHelper) CheckoutRemoteBranch(fullBranchName string, localBranchN
if err := self.c.Git().Branch.CreateWithUpstream(localBranchName, fullBranchName); err != nil {
return err
}
// Do a sync refresh to make sure the new branch is visible,
// so that we see an inline status when checking it out
// Refresh the branches and check out from Then, so that the
// new branch is already in the model when CheckoutRef looks
// it up; that's what makes it show an inline status on the
// branch rather than a global waiting status.
self.c.Refresh(types.RefreshOptions{
Scope: []types.RefreshableView{types.BRANCHES},
Then: func() error {
return checkout(localBranchName, true)
},
})
return checkout(localBranchName, true)
return nil
},
},
{