summaryrefslogtreecommitdiffstats
path: root/pkg/gui/reflog_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-01-30 09:53:28 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-03-17 19:13:40 +1100
commit51547e38227b2443de955f4d17d46429039cf9f1 (patch)
treec1d8eccaa7736713b01cb00b574e9ed65c60bc8d /pkg/gui/reflog_panel.go
parente363606fb6eeff130e38466f5a63a3a8c0e6ec0d (diff)
move all refresh code into the one file
Diffstat (limited to 'pkg/gui/reflog_panel.go')
-rw-r--r--pkg/gui/reflog_panel.go46
1 files changed, 0 insertions, 46 deletions
diff --git a/pkg/gui/reflog_panel.go b/pkg/gui/reflog_panel.go
index 74254fa7b..7f46a2748 100644
--- a/pkg/gui/reflog_panel.go
+++ b/pkg/gui/reflog_panel.go
@@ -37,52 +37,6 @@ func (gui *Gui) reflogCommitsRenderToMain() error {
})
}
-// the reflogs panel is the only panel where we cache data, in that we only
-// load entries that have been created since we last ran the call. This means
-// we need to be more careful with how we use this, and to ensure we're emptying
-// the reflogs array when changing contexts.
-// This method also manages two things: ReflogCommits and FilteredReflogCommits.
-// FilteredReflogCommits are rendered in the reflogs panel, and ReflogCommits
-// are used by the branches panel to obtain recency values for sorting.
-func (gui *Gui) refreshReflogCommits() error {
- // pulling state into its own variable incase it gets swapped out for another state
- // and we get an out of bounds exception
- state := gui.State
- var lastReflogCommit *models.Commit
- if len(state.ReflogCommits) > 0 {
- lastReflogCommit = state.ReflogCommits[0]
- }
-
- refresh := func(stateCommits *[]*models.Commit, filterPath string) error {
- commits, onlyObtainedNewReflogCommits, err := gui.git.Loaders.ReflogCommits.
- GetReflogCommits(lastReflogCommit, filterPath)
- if err != nil {
- return gui.c.Error(err)
- }
-
- if onlyObtainedNewReflogCommits {
- *stateCommits = append(commits, *stateCommits...)
- } else {
- *stateCommits = commits
- }
- return nil
- }
-
- if err := refresh(&state.ReflogCommits, ""); err != nil {
- return err
- }
-
- if gui.State.Modes.Filtering.Active() {
- if err := refresh(&state.FilteredReflogCommits, state.Modes.Filtering.GetPath()); err != nil {
- return err
- }
- } else {
- state.FilteredReflogCommits = state.ReflogCommits
- }
-
- return gui.c.PostRefreshUpdate(gui.State.Contexts.ReflogCommits)
-}
-
func (gui *Gui) CheckoutReflogCommit() error {
commit := gui.getSelectedReflogCommit()
if commit == nil {