diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java index 568fcdcd0..dd143826e 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java @@ -119,6 +119,11 @@ public abstract class LocalDiskRepositoryTestCase extends TestCase { shutdownHook = new Thread() { @Override public void run() { + // On windows accidentally open files or memory + // mapped regions may prevent files from being deleted. + // Suggesting a GC increases the likelihood that our + // test repositories actually get removed after the + // tests, even in the case of failure. System.gc(); recursiveDelete("SHUTDOWN", trash, false, false); }