summaryrefslogtreecommitdiffstats
path: root/pkg/gui/commits_panel.go
diff options
context:
space:
mode:
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
}