summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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();
}