summaryrefslogtreecommitdiffstats
path: root/pkg/gui/reflog_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-03-28 11:22:11 +1100
committerJesse Duffield <jessedduffield@gmail.com>2020-03-28 11:59:45 +1100
commit3f7ec3f3b801f33ca8b2bc436d8f047cdf57b4f0 (patch)
tree7d300178ab6d053c867deb2aaac28c0dcbd86cbf /pkg/gui/reflog_panel.go
parent19604214d7da76a685085961095c1d7b2ad5f5cb (diff)
load reflog commits in two stages to speed up startup time
Diffstat (limited to 'pkg/gui/reflog_panel.go')
-rw-r--r--pkg/gui/reflog_panel.go11
1 files changed, 8 insertions, 3 deletions
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