aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorandrewxian2000 <andrew.xian2000@gmail.com>2021-06-15 09:58:52 +1200
committerandrewxian2000 <andrew.xian2000@gmail.com>2021-06-24 11:03:27 +1200
commit64b0dee98fab8dd145ea389d3d7b18d9dcaab218 (patch)
treeb9abf93ebbb25d9954ea3f3b79ec3f7891b0fffb /org.eclipse.jgit
parent2533a284c1bf30477c4a61f4893929201a1244f3 (diff)
downloadjgit-64b0dee98fab8dd145ea389d3d7b18d9dcaab218.tar.gz
jgit-64b0dee98fab8dd145ea389d3d7b18d9dcaab218.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());
}
}