mirror of
https://github.com/restic/restic.git
synced 2026-03-26 07:52:44 +00:00
repository: set progress bar maximum in Repack
This commit is contained in:
@@ -243,9 +243,7 @@ func copyTree(ctx context.Context, srcRepo restic.Repository, dstRepo restic.Rep
|
||||
}
|
||||
|
||||
bar := printer.NewCounter("packs copied")
|
||||
bar.SetMax(uint64(len(packList)))
|
||||
err = repository.Repack(ctx, srcRepo, dstRepo, packList, copyBlobs, bar, printer.P)
|
||||
bar.Done()
|
||||
if err != nil {
|
||||
return errors.Fatalf("%s", err)
|
||||
}
|
||||
|
||||
@@ -563,9 +563,7 @@ func (plan *PrunePlan) Execute(ctx context.Context, printer progress.Printer) er
|
||||
if len(plan.repackPacks) != 0 {
|
||||
printer.P("repacking packs\n")
|
||||
bar := printer.NewCounter("packs repacked")
|
||||
bar.SetMax(uint64(len(plan.repackPacks)))
|
||||
err := Repack(ctx, repo, repo, plan.repackPacks, plan.keepBlobs, bar, printer.P)
|
||||
bar.Done()
|
||||
if err != nil {
|
||||
return errors.Fatalf("%s", err)
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ func Repack(
|
||||
if logf == nil {
|
||||
logf = func(_ string, _ ...interface{}) {}
|
||||
}
|
||||
p.SetMax(uint64(len(packs)))
|
||||
defer p.Done()
|
||||
|
||||
if repo == dstRepo && dstRepo.Connections() < 2 {
|
||||
return errors.New("repack step requires a backend connection limit of at least two")
|
||||
|
||||
Reference in New Issue
Block a user