mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-06 22:33:07 +02:00
Don't get reflog commits twice unnecessarily in filtering mode
I can only guess what happened here: inaa750c0819
, 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 (in8822c409e2
), 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.
This commit is contained in:
@ -449,21 +449,8 @@ func (self *RefreshHelper) refreshBranches(refreshWorktrees bool, keepBranchSele
|
|||||||
self.c.Mutexes().RefreshingBranchesMutex.Lock()
|
self.c.Mutexes().RefreshingBranchesMutex.Lock()
|
||||||
defer self.c.Mutexes().RefreshingBranchesMutex.Unlock()
|
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(
|
branches, err := self.c.Git().Loaders.BranchLoader.Load(
|
||||||
reflogCommits,
|
self.c.Model().ReflogCommits,
|
||||||
self.c.Model().MainBranches,
|
self.c.Model().MainBranches,
|
||||||
self.c.Model().Branches,
|
self.c.Model().Branches,
|
||||||
loadBehindCounts,
|
loadBehindCounts,
|
||||||
|
Reference in New Issue
Block a user