mirror of
https://github.com/restic/restic.git
synced 2025-12-12 03:31:56 +00:00
repository: deduplicate index progress bar initializaton
This commit is contained in:
@@ -639,13 +639,18 @@ func (r *Repository) clearIndex() {
|
||||
}
|
||||
|
||||
// LoadIndex loads all index files from the backend in parallel and stores them
|
||||
func (r *Repository) LoadIndex(ctx context.Context, p *progress.Counter) error {
|
||||
func (r *Repository) LoadIndex(ctx context.Context, p restic.TerminalCounterFactory) error {
|
||||
debug.Log("Loading index")
|
||||
|
||||
// reset in-memory index before loading it from the repository
|
||||
r.clearIndex()
|
||||
|
||||
err := r.idx.Load(ctx, r, p, nil)
|
||||
var bar *progress.Counter
|
||||
if p != nil {
|
||||
bar = p.NewCounterTerminalOnly("index files loaded")
|
||||
}
|
||||
|
||||
err := r.idx.Load(ctx, r, bar, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user