From 3f7ec3f3b801f33ca8b2bc436d8f047cdf57b4f0 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 28 Mar 2020 11:22:11 +1100 Subject: load reflog commits in two stages to speed up startup time --- pkg/gui/reflog_panel.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'pkg/gui/reflog_panel.go') diff --git a/pkg/gui/reflog_panel.go b/pkg/gui/reflog_panel.go index d40467b28..3d9ecf01c 100644 --- a/pkg/gui/reflog_panel.go +++ b/pkg/gui/reflog_panel.go @@ -46,18 +46,23 @@ func (gui *Gui) handleReflogCommitSelect(g *gocui.Gui, v *gocui.View) error { return nil } -func (gui *Gui) refreshReflogCommits() error { +type refreshReflogOptions struct { + Limit int + Recycle bool +} + +func (gui *Gui) refreshReflogCommits(options refreshReflogOptions) error { var lastReflogCommit *commands.Commit if len(gui.State.ReflogCommits) > 0 { lastReflogCommit = gui.State.ReflogCommits[0] } - commits, foundLastReflogCommit, err := gui.GitCommand.GetNewReflogCommits(lastReflogCommit) + commits, onlyObtainedNewReflogCommits, err := gui.GitCommand.GetReflogCommits(lastReflogCommit, commands.GetReflogCommitsOptions(options)) if err != nil { return gui.createErrorPanel(gui.g, err.Error()) } - if foundLastReflogCommit { + if onlyObtainedNewReflogCommits { gui.State.ReflogCommits = append(commits, gui.State.ReflogCommits...) } else { // if we haven't found it we're probably in a new repo so we don't want to -- cgit v1.2.3