From 934276ac401cd51bd05b750d1b6f27ba94dd393a Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Thu, 10 Jul 2025 14:00:01 +0200 Subject: [PATCH] Use the non-filtered reflog for undoing Using the filtered one is probably not a good idea. It didn't do much harm because the split of ReflogCommits and FilteredReflogCommits doesn't really work right now (FilteredReflogCommits is always the same as ReflogCommits, even in filtering mode), but we'll fix this in the next commit. --- pkg/gui/controllers/undo_controller.go | 2 +- pkg/gui/types/common.go | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/gui/controllers/undo_controller.go b/pkg/gui/controllers/undo_controller.go index ecff5bea8..cd3b04e4f 100644 --- a/pkg/gui/controllers/undo_controller.go +++ b/pkg/gui/controllers/undo_controller.go @@ -199,7 +199,7 @@ func (self *UndoController) reflogRedo() error { // Though we might support this later, hence the use of the CURRENT_REBASE action kind. func (self *UndoController) parseReflogForActions(onUserAction func(counter int, action reflogAction) (bool, error)) error { counter := 0 - reflogCommits := self.c.Model().FilteredReflogCommits + reflogCommits := self.c.Model().ReflogCommits rebaseFinishCommitHash := "" var action *reflogAction for reflogCommitIdx, reflogCommit := range reflogCommits { diff --git a/pkg/gui/types/common.go b/pkg/gui/types/common.go index bf7267a8c..7d8528ee8 100644 --- a/pkg/gui/types/common.go +++ b/pkg/gui/types/common.go @@ -289,10 +289,11 @@ type Model struct { Worktrees []*models.Worktree // FilteredReflogCommits are the ones that appear in the reflog panel. - // when in filtering mode we only include the ones that match the given path + // When in filtering mode we only include the ones that match the given path FilteredReflogCommits []*models.Commit - // ReflogCommits are the ones used by the branches panel to obtain recency values - // if we're not in filtering mode, CommitFiles and FilteredReflogCommits will be + // ReflogCommits are the ones used by the branches panel to obtain recency values, + // and for the undo functionality. + // If we're not in filtering mode, CommitFiles and FilteredReflogCommits will be // one and the same ReflogCommits []*models.Commit