Don't access Model in refreshReflogCommits

This was old code that was supposed to make a race less likely, but now
that we capture model stuff on the UI thread we don't need it any more.
This commit is contained in:
Stefan Haller 2026-07-10 22:43:26 +02:00
parent d36ce51559
commit 2a7b74d3f3

View file

@ -1313,10 +1313,6 @@ func (self *RefreshHelper) refreshStateFiles(captured capturedFilesState, env re
// that a subsequent branches refresh can use them for recency sorting without
// having to read them back out of the model.
func (self *RefreshHelper) refreshReflogCommits(captured capturedReflogState, env refreshEnv, selectTopEntry bool) ([]*models.Commit, error) {
// pulling state into its own variable in case it gets swapped out for another state
// and we get an out of bounds exception
model := self.c.Model()
// load does the git work on the worker and returns the new value for a
// reflog slice, reading the existing slice (captured on the UI thread) for
// the incremental fetch. The caller writes the result in the bounce.
@ -1352,8 +1348,8 @@ func (self *RefreshHelper) refreshReflogCommits(captured capturedReflogState, en
}
self.onUIThreadUnlessRepoChanged(env, func() {
model.ReflogCommits = reflogCommits
model.FilteredReflogCommits = filteredReflogCommits
self.c.Model().ReflogCommits = reflogCommits
self.c.Model().FilteredReflogCommits = filteredReflogCommits
// Setting the selection here, in the same bounce that writes the list,
// keeps it on the UI thread and atomic with the list update. Setting the
// selection doesn't scroll the view, so also reset the origin.