From d99ceb91eefa424b6e3831b5c65011b0b5a41eee Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 11 Jul 2025 18:05:24 +0200 Subject: [PATCH] Don't get reflog commits twice unnecessarily in filtering mode I can only guess what happened here: in aa750c08192d, this code to manually load the reflog commits was added, to make sorting branches by recency work when the reflog is filtered by path. At that time we didn't have separate ReflogCommits and FilteredReflogCommits models yet. Then, FilteredReflogCommits was introduced (in 8822c409e24), probably for the very purpose of being able to get rid of this again; but then it was forgotton to actually get rid of it. The funny thing is that the introduction of FilteredReflogCommits happened in the very next commit, 15 minutes later. --- pkg/gui/controllers/helpers/refresh_helper.go | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/pkg/gui/controllers/helpers/refresh_helper.go b/pkg/gui/controllers/helpers/refresh_helper.go index dc396be3f..7c27225e5 100644 --- a/pkg/gui/controllers/helpers/refresh_helper.go +++ b/pkg/gui/controllers/helpers/refresh_helper.go @@ -449,21 +449,8 @@ func (self *RefreshHelper) refreshBranches(refreshWorktrees bool, keepBranchSele self.c.Mutexes().RefreshingBranchesMutex.Lock() defer self.c.Mutexes().RefreshingBranchesMutex.Unlock() - reflogCommits := self.c.Model().FilteredReflogCommits - if self.c.Modes().Filtering.Active() && self.c.UserConfig().Git.LocalBranchSortOrder == "recency" { - // in filter mode we filter our reflog commits to just those containing the path - // however we need all the reflog entries to populate the recencies of our branches - // which allows us to order them correctly. So if we're filtering we'll just - // manually load all the reflog commits here - var err error - reflogCommits, _, err = self.c.Git().Loaders.ReflogCommitLoader.GetReflogCommits(self.c.Model().HashPool, nil, "", "") - if err != nil { - self.c.Log.Error(err) - } - } - branches, err := self.c.Git().Loaders.BranchLoader.Load( - reflogCommits, + self.c.Model().ReflogCommits, self.c.Model().MainBranches, self.c.Model().Branches, loadBehindCounts,