summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2016-12-24 00:29:31 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2016-12-24 00:30:00 +0100
commit5274da3c3ca8d59c4cce41914776837f457ca734 (patch)
tree6605d3ec2b2e39c1fd0bea89764e696d80727a78
parent1fb2319c188d68412c40189d298e51f62c899944 (diff)
parent4ddd4a3d1b38ecf908978d596531ac9cdc7544dd (diff)
downloadjgit-5274da3c3ca8d59c4cce41914776837f457ca734.tar.gz
jgit-5274da3c3ca8d59c4cce41914776837f457ca734.zip
Merge branch 'stable-4.5'
* origin/stable-4.5: Fix one case of missing object Change-Id: Ia6384f4be71086d5a0a8c42c7521220f57dfd086 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java11
1 files changed, 8 insertions, 3 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 9c048da40e..147e54dce8 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
@@ -459,9 +459,14 @@ public class GC {
return;
// delete all candidates which have survived: these are unreferenced
- // loose objects
- for (File f : deletionCandidates.values())
- f.delete();
+ // loose objects. Make a last check, though, to avoid deleting objects
+ // that could have been referenced while the candidates list was being
+ // built (by an incoming push, for example).
+ for (File f : deletionCandidates.values()) {
+ if (f.lastModified() < expireDate) {
+ f.delete();
+ }
+ }
repo.getObjectDatabase().close();
}