aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2023-03-18 21:13:27 +0100
committerMichael Muré <batolettre@gmail.com>2023-03-18 21:13:27 +0100
commit281d4a642d87a23ed62045db899ff967abf8b818 (patch)
tree97b4436d20983874925a864d33223f4d9a541bef
parent56202ec0c2da653239988b2e13f5a323210d8ab3 (diff)
downloadgit-bug-281d4a642d87a23ed62045db899ff967abf8b818.tar.gz
execenv: fix some cache building progress bar artifact
Still one issue remaining: the last bar doesn't dissapear. Looks like a mbp issue.
-rw-r--r--cache/repo_cache.go5
-rw-r--r--commands/execenv/loading.go8
2 files changed, 11 insertions, 2 deletions
diff --git a/cache/repo_cache.go b/cache/repo_cache.go
index 9e45d1f1..19b6e266 100644
--- a/cache/repo_cache.go
+++ b/cache/repo_cache.go
@@ -210,10 +210,15 @@ type BuildEventType int
const (
_ BuildEventType = iota
+ // BuildEventCacheIsBuilt signal that the cache is being built (aka, not skipped)
BuildEventCacheIsBuilt
+ // BuildEventRemoveLock signal that an old repo lock has been cleaned
BuildEventRemoveLock
+ // BuildEventStarted signal the beginning of a cache build for an entity
BuildEventStarted
+ // BuildEventProgress signal progress in the cache building for an entity
BuildEventProgress
+ // BuildEventFinished signal the end of a cache build for an entity
BuildEventFinished
)
diff --git a/commands/execenv/loading.go b/commands/execenv/loading.go
index 2263f700..7838ea6a 100644
--- a/commands/execenv/loading.go
+++ b/commands/execenv/loading.go
@@ -156,13 +156,17 @@ func CacheBuildProgressBar(env *Env, events chan cache.BuildEvent) error {
mpb.AppendDecorators(decor.Percentage(decor.WCSyncSpace)),
)
case cache.BuildEventProgress:
- bars[event.Typename].SetTotal(event.Total, false)
bars[event.Typename].SetCurrent(event.Progress)
+ bars[event.Typename].SetTotal(event.Total, event.Progress == event.Total)
+ case cache.BuildEventFinished:
+ if bar := bars[event.Typename]; !bar.Completed() {
+ bar.SetTotal(0, true)
+ }
}
}
if progress != nil {
- progress.Shutdown()
+ progress.Wait()
}
return nil