aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorandrewxian2000 <andrew.xian2000@gmail.com>2021-06-15 09:58:52 +1200
committerMatthias Sohn <matthias.sohn@sap.com>2021-06-22 14:16:30 +0200
commit1ae7e08bcae3a82c8cb201affae8136332753cb4 (patch)
tree952e765d85eb7c967cf0656b5f2c9886d7447add /org.eclipse.jgit
parentfc57689774c5503838c96ee305f4977c585e87a2 (diff)
downloadjgit-1ae7e08bcae3a82c8cb201affae8136332753cb4.tar.gz
jgit-1ae7e08bcae3a82c8cb201affae8136332753cb4.zip
Fix garbage collection failing to delete pack file
The loosen() method has opened pack file and the open pack file handle may prevent it from being deleted e.g. on Windows. Fix this by closing the pack file only after loosen() finished. Bug: 574178 Change-Id: Icd59931a218d84c9c97b450eea87b21ed01248ff Signed-off-by: andrew.xian2000@gmail.com Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java2
1 files changed, 1 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 9ffff9f662..40c075ec5e 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
@@ -344,10 +344,10 @@ public class GC {
&& repo.getFS()
.lastModifiedInstant(oldPack.getPackFile())
.toEpochMilli() < packExpireDate) {
- oldPack.close();
if (shouldLoosen) {
loosen(inserter, reader, oldPack, ids);
}
+ oldPack.close();
prunePack(oldPack.getPackFile());
}
}