When loosening the objects inside the packfiles to be pruned, make sure
that the packfile list is stable and prune all the files after the
loosening is done.
This prevents a series of exceptions previously thrown when loosening
the packfiles, due to the too early pruning of the packfiles that were
still in the pack list.
Bug: 581532
Change-Id: I776776e2e083f1fa749d53f965bf50f919823b4f
prunePreserved();
long packExpireDate = getPackExpireDate();
+ List<PackFile> packFilesToPrune = new ArrayList<>();
oldPackLoop: for (Pack oldPack : oldPacks) {
checkCancelled();
String oldName = oldPack.getPackName();
loosen(inserter, reader, oldPack, ids);
}
oldPack.close();
- prunePack(oldPack.getPackFile());
+ packFilesToPrune.add(oldPack.getPackFile());
}
}
+ packFilesToPrune.forEach(this::prunePack);
// close the complete object database. That's my only chance to force
// rescanning and to detect that certain pack files are now deleted.