diff options
author | Luca Milanesio <luca.milanesio@gmail.com> | 2023-06-11 17:24:29 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2023-07-05 15:28:16 +0200 |
commit | ac8d7838f0ca332f7143be25ac511831f2705961 (patch) | |
tree | 08335cdc54b8149574df698864b4491aedd04a4a | |
parent | dd92c1aa98c25bb1a2c2cbb0a056e6e34c64b385 (diff) | |
download | jgit-ac8d7838f0ca332f7143be25ac511831f2705961.tar.gz jgit-ac8d7838f0ca332f7143be25ac511831f2705961.zip |
GC: prune all packfiles after the loosen phase
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
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java | 4 |
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. |