mirror of
https://github.com/restic/restic.git
synced 2024-12-23 08:16:36 +00:00
Add comments, clarify computation
This commit is contained in:
parent
d2e53730d6
commit
47277c4b4c
1 changed files with 7 additions and 2 deletions
|
@ -473,14 +473,19 @@ func prune(opts PruneOptions, gopts GlobalOptions, repo restic.Repository, usedB
|
||||||
|
|
||||||
packsAddedByRepack := 0
|
packsAddedByRepack := 0
|
||||||
if len(repackPacks) != 0 {
|
if len(repackPacks) != 0 {
|
||||||
packsAddedByRepack -= len(repo.Index().Packs())
|
// Remember the number of unique packs before repacking
|
||||||
|
packsBeforeRepacking := len(repo.Index().Packs())
|
||||||
|
|
||||||
Verbosef("repacking packs\n")
|
Verbosef("repacking packs\n")
|
||||||
bar := newProgressMax(!gopts.Quiet, uint64(len(repackPacks)), "packs repacked")
|
bar := newProgressMax(!gopts.Quiet, uint64(len(repackPacks)), "packs repacked")
|
||||||
_, err := repository.Repack(ctx, repo, repackPacks, keepBlobs, bar)
|
_, err := repository.Repack(ctx, repo, repackPacks, keepBlobs, bar)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
packsAddedByRepack += len(repo.Index().Packs())
|
|
||||||
|
// Since repacking will only add new packs, we can calculate the number
|
||||||
|
// of packs like this:
|
||||||
|
packsAddedByRepack = len(repo.Index().Packs()) - packsBeforeRepacking
|
||||||
|
|
||||||
// Also remove repacked packs
|
// Also remove repacked packs
|
||||||
removePacks.Merge(repackPacks)
|
removePacks.Merge(repackPacks)
|
||||||
|
|
Loading…
Reference in a new issue