summaryrefslogtreecommitdiffstats
path: root/pkg/gui/commits_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-03-28 10:27:34 +1100
committerJesse Duffield <jessedduffield@gmail.com>2020-03-28 11:59:45 +1100
commitf7add8d788604743b334c72b784c487968b99867 (patch)
tree64c850b77954d15e5a2451ce4b6aa089cf578b11 /pkg/gui/commits_panel.go
parentd97c2307476253be353edc1ad85c2658c0f78ebe (diff)
smarter refreshing for tags and remotes
Diffstat (limited to 'pkg/gui/commits_panel.go')
-rw-r--r--pkg/gui/commits_panel.go10
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
}