repository: Use existing method to collect pack ids

This commit is contained in:
Michael Eischer 2021-08-16 16:01:11 +02:00
parent b335cb6285
commit cf5cb673fb

View file

@ -736,12 +736,7 @@ func (r *Repository) PrepareCache() error {
fmt.Fprintf(os.Stderr, "error clearing index files in cache: %v\n", err)
}
packs := restic.NewIDSet()
for _, idx := range r.idx.All() {
for id := range idx.Packs() {
packs.Insert(id)
}
}
packs := r.idx.Packs(restic.NewIDSet())
// clear old packs
err = r.Cache.Clear(restic.PackFile, packs)