summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
index 4fc9582d33..4bb7c8f3d3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
@@ -347,6 +347,7 @@ public class GC {
prunePreserved();
long packExpireDate = getPackExpireDate();
+ List<PackFile> packFilesToPrune = new ArrayList<>();
oldPackLoop: for (Pack oldPack : oldPacks) {
checkCancelled();
String oldName = oldPack.getPackName();
@@ -364,9 +365,10 @@ public class GC {
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.