Skip to content

Commit e1d728e

Browse files
committed
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.
1 parent 934276a commit e1d728e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pkg/gui/controllers/helpers/refresh_helper.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -607,12 +607,13 @@ func (self *RefreshHelper) refreshReflogCommits() error {
607607
// pulling state into its own variable in case it gets swapped out for another state
608608
// and we get an out of bounds exception
609609
model := self.c.Model()
610-
var lastReflogCommit *models.Commit
611-
if len(model.ReflogCommits) > 0 {
612-
lastReflogCommit = model.ReflogCommits[0]
613-
}
614610

615611
refresh := func(stateCommits *[]*models.Commit, filterPath string, filterAuthor string) error {
612+
var lastReflogCommit *models.Commit
613+
if filterPath == "" && filterAuthor == "" && len(*stateCommits) > 0 {
614+
lastReflogCommit = (*stateCommits)[0]
615+
}
616+
616617
commits, onlyObtainedNewReflogCommits, err := self.c.Git().Loaders.ReflogCommitLoader.
617618
GetReflogCommits(self.c.Model().HashPool, lastReflogCommit, filterPath, filterAuthor)
618619
if err != nil {

0 commit comments

Comments
 (0)