diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-28 10:27:34 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-28 11:59:45 +1100 |
commit | f7add8d788604743b334c72b784c487968b99867 (patch) | |
tree | 64c850b77954d15e5a2451ce4b6aa089cf578b11 /pkg/gui/commits_panel.go | |
parent | d97c2307476253be353edc1ad85c2658c0f78ebe (diff) |
smarter refreshing for tags and remotes
Diffstat (limited to 'pkg/gui/commits_panel.go')
-rw-r--r-- | pkg/gui/commits_panel.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go index 622007967..01e006829 100644 --- a/pkg/gui/commits_panel.go +++ b/pkg/gui/commits_panel.go @@ -71,6 +71,13 @@ func (gui *Gui) handleCommitSelect(g *gocui.Gui, v *gocui.View) error { return nil } +// whenever we change commits, we should update branches because the upstream/downstream +// counts can change. Whenever we change branches we should probably also change commits +// e.g. in the case of switching branches. We also need the status to be refreshed whenever +// the working tree status changes or the branch upstream/downstream value changes. +// Given how fast the refreshStatus method is, we should really just call it every time +// we refresh, but I'm not sure how to do that asynchronously that prevents a race condition +// other than a mutex. func (gui *Gui) refreshCommits() error { wg := sync.WaitGroup{} wg.Add(2) @@ -78,6 +85,7 @@ func (gui *Gui) refreshCommits() error { go func() { gui.refreshReflogCommits() gui.refreshBranches() + gui.refreshStatus() wg.Done() }() @@ -91,8 +99,6 @@ func (gui *Gui) refreshCommits() error { wg.Wait() - gui.refreshStatus() - return nil } |