Skip to content

Commit d99ceb9

Browse files
committed
Don't get reflog commits twice unnecessarily in filtering mode
I can only guess what happened here: in aa750c0, 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 8822c40), 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.
1 parent 92b5bad commit d99ceb9

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

pkg/gui/controllers/helpers/refresh_helper.go

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -449,21 +449,8 @@ func (self *RefreshHelper) refreshBranches(refreshWorktrees bool, keepBranchSele
449449
self.c.Mutexes().RefreshingBranchesMutex.Lock()
450450
defer self.c.Mutexes().RefreshingBranchesMutex.Unlock()
451451

452-
reflogCommits := self.c.Model().FilteredReflogCommits
453-
if self.c.Modes().Filtering.Active() && self.c.UserConfig().Git.LocalBranchSortOrder == "recency" {
454-
// in filter mode we filter our reflog commits to just those containing the path
455-
// however we need all the reflog entries to populate the recencies of our branches
456-
// which allows us to order them correctly. So if we're filtering we'll just
457-
// manually load all the reflog commits here
458-
var err error
459-
reflogCommits, _, err = self.c.Git().Loaders.ReflogCommitLoader.GetReflogCommits(self.c.Model().HashPool, nil, "", "")
460-
if err != nil {
461-
self.c.Log.Error(err)
462-
}
463-
}
464-
465452
branches, err := self.c.Git().Loaders.BranchLoader.Load(
466-
reflogCommits,
453+
self.c.Model().ReflogCommits,
467454
self.c.Model().MainBranches,
468455
self.c.Model().Branches,
469456
loadBehindCounts,

0 commit comments

Comments
 (0)