From e1d728ee5ebde56ed165c0f5b3f1b6520d77334a Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 11 Jul 2025 17:56:28 +0200 Subject: [PATCH] Fix showing only filtered reflog entries when filtering by path Recycle reflog commits only for the non-filtered ones. If we're not filtering, FilteredReflogCommits and ReflogCommits are the same. If we then enter filtering and get reflog entries again, and pass a lastReflogCommit, we'd recycle the previous FilteredReflogCommits, which are unfiltered, so that's no good. Work around this by simply never using the recycle mechanism when getting the filtered reflog commits. We could do better by remembering what the last filter path or author was, and only suppressing the recycling when it changed; but that's more complexity than I want to add, so hopefully this is good enough. --- pkg/gui/controllers/helpers/refresh_helper.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/gui/controllers/helpers/refresh_helper.go b/pkg/gui/controllers/helpers/refresh_helper.go index 7c27225e5..24958c65d 100644 --- a/pkg/gui/controllers/helpers/refresh_helper.go +++ b/pkg/gui/controllers/helpers/refresh_helper.go @@ -607,12 +607,13 @@ func (self *RefreshHelper) refreshReflogCommits() 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() - var lastReflogCommit *models.Commit - if len(model.ReflogCommits) > 0 { - lastReflogCommit = model.ReflogCommits[0] - } refresh := func(stateCommits *[]*models.Commit, filterPath string, filterAuthor string) error { + var lastReflogCommit *models.Commit + if filterPath == "" && filterAuthor == "" && len(*stateCommits) > 0 { + lastReflogCommit = (*stateCommits)[0] + } + commits, onlyObtainedNewReflogCommits, err := self.c.Git().Loaders.ReflogCommitLoader. GetReflogCommits(self.c.Model().HashPool, lastReflogCommit, filterPath, filterAuthor) if err != nil {