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
|
||||
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")
|
||||
bar := newProgressMax(!gopts.Quiet, uint64(len(repackPacks)), "packs repacked")
|
||||
_, err := repository.Repack(ctx, repo, repackPacks, keepBlobs, bar)
|
||||
if err != nil {
|
||||
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
|
||||
removePacks.Merge(repackPacks)
|
||||
|
|
Loading…
Reference in a new issue