@Override public void finalCleanUp() { if (revWalk != null) { revWalk.dispose(); } // http://www.programcreek.com/java-api-examples/index.php?api=org.eclipse.jgit.storage.file.WindowCacheConfig // Example 3 if (git != null) { git.close(); // git.close() is not enough with jGit on Windows // remove the references from packFile by initializing cache used in the repository // fixing lock issues on Windows when repository has pack files WindowCacheConfig config = new WindowCacheConfig(); config.install(); } }
@Override public void finalCleanUp() { if (revWalk != null) { revWalk.dispose(); } // http://www.programcreek.com/java-api-examples/index.php?api=org.eclipse.jgit.storage.file.WindowCacheConfig // Example 3 if (git != null) { git.close(); // git.close() is not enough with jGit on Windows // remove the references from packFile by initializing cache used in the repository // fixing lock issues on Windows when repository has pack files WindowCacheConfig config = new WindowCacheConfig(); config.install(); } }
cfg.install(); git.getRepository().close(); git = null;
@Before public void setUp() throws Exception { tmp = File.createTempFile("jgit_test_", "_tmp"); CleanupThread.deleteOnShutdown(tmp); if (!tmp.delete() || !tmp.mkdir()) throw new IOException("Cannot create " + tmp); mockSystemReader = new MockSystemReader(); mockSystemReader.userGitConfig = new FileBasedConfig(new File(tmp, "usergitconfig"), FS.DETECTED); ceilTestDirectories(getCeilings()); SystemReader.setInstance(mockSystemReader); final long now = mockSystemReader.getCurrentTime(); final int tz = mockSystemReader.getTimezone(now); author = new PersonIdent("J. Author", "jauthor@example.com"); author = new PersonIdent(author, now, tz); committer = new PersonIdent("J. Committer", "jcommitter@example.com"); committer = new PersonIdent(committer, now, tz); final WindowCacheConfig c = new WindowCacheConfig(); c.setPackedGitLimit(128 * WindowCacheConfig.KB); c.setPackedGitWindowSize(8 * WindowCacheConfig.KB); c.setPackedGitMMAP(useMMAP); c.setDeltaBaseCacheLimit(8 * WindowCacheConfig.KB); c.install(); }
@Before public void setUp() throws Exception { tmp = File.createTempFile("jgit_test_", "_tmp"); CleanupThread.deleteOnShutdown(tmp); if (!tmp.delete() || !tmp.mkdir()) throw new IOException("Cannot create " + tmp); mockSystemReader = new MockSystemReader(); mockSystemReader.userGitConfig = new FileBasedConfig(new File(tmp, "usergitconfig"), FS.DETECTED); ceilTestDirectories(getCeilings()); SystemReader.setInstance(mockSystemReader); final long now = mockSystemReader.getCurrentTime(); final int tz = mockSystemReader.getTimezone(now); author = new PersonIdent("J. Author", "jauthor@example.com"); author = new PersonIdent(author, now, tz); committer = new PersonIdent("J. Committer", "jcommitter@example.com"); committer = new PersonIdent(committer, now, tz); final WindowCacheConfig c = new WindowCacheConfig(); c.setPackedGitLimit(128 * WindowCacheConfig.KB); c.setPackedGitWindowSize(8 * WindowCacheConfig.KB); c.setPackedGitMMAP(useMMAP); c.setDeltaBaseCacheLimit(8 * WindowCacheConfig.KB); c.install(); }
c.setPackedGitMMAP(useMMAP); c.setDeltaBaseCacheLimit(8 * WindowCacheConfig.KB); c.install();
@Test @FixFor( "MODE-2643") public void shouldReadBinaryNodeAsLargeFile() throws Exception { //use some JGit API magic to reconfigure the default threshold which is around 50MB //so that when we attempt to read a larger binary, it will be seen as a large file by JGit WindowCacheConfig newConfig = new WindowCacheConfig(); newConfig.setStreamFileThreshold(2 * WindowCacheConfig.MB); newConfig.install(); try { readLargeBinary(); } finally { newConfig.setStreamFileThreshold(PackConfig.DEFAULT_BIG_FILE_THRESHOLD); newConfig.install(); } }
new WindowCacheConfig().fromConfig(cfg).install(); packConfig.fromConfig(cfg);