From aa750c08192d9d19c32bd4a6125cdcd9bd66595f Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sun, 29 Mar 2020 10:52:01 +1100 Subject: load reflog commits manually when in filter mode for branches panel --- pkg/gui/branches_panel.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index c7cba8aea..624b529e5 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -54,7 +54,20 @@ func (gui *Gui) handleBranchSelect(g *gocui.Gui, v *gocui.View) error { // gui.refreshStatus is called at the end of this because that's when we can // be sure there is a state.Branches array to pick the current branch from func (gui *Gui) refreshBranches() { - builder, err := commands.NewBranchListBuilder(gui.Log, gui.GitCommand, gui.State.ReflogCommits) + reflogCommits := gui.State.ReflogCommits + if gui.inFilterMode() { + // 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 = gui.GitCommand.GetReflogCommits(nil, "") + if err != nil { + gui.Log.Error(err) + } + } + + builder, err := commands.NewBranchListBuilder(gui.Log, gui.GitCommand, reflogCommits) if err != nil { _ = gui.surfaceError(err) } -- cgit v1.2.3