mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-06 22:33:07 +02:00
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.
This commit is contained in:
@ -607,12 +607,13 @@ func (self *RefreshHelper) refreshReflogCommits() error {
|
|||||||
// pulling state into its own variable in case it gets swapped out for another state
|
// pulling state into its own variable in case it gets swapped out for another state
|
||||||
// and we get an out of bounds exception
|
// and we get an out of bounds exception
|
||||||
model := self.c.Model()
|
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 {
|
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.
|
commits, onlyObtainedNewReflogCommits, err := self.c.Git().Loaders.ReflogCommitLoader.
|
||||||
GetReflogCommits(self.c.Model().HashPool, lastReflogCommit, filterPath, filterAuthor)
|
GetReflogCommits(self.c.Model().HashPool, lastReflogCommit, filterPath, filterAuthor)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user