@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(); } }
private void cleanupDir(final File gitDir) { try { if (System.getProperty("os.name").toLowerCase().contains("windows")) { //this operation forces a cache clean freeing any lock -> windows only issue! WindowCache.reconfigure(new WindowCacheConfig()); } FileUtils.delete(gitDir, FileUtils.RECURSIVE | FileUtils.RETRY); } catch (java.io.IOException e) { throw new org.uberfire.java.nio.IOException("Failed to remove the git repository.", e); } } }
private void cleanupDir(final File gitDir) { try { if (System.getProperty("os.name").toLowerCase().contains("windows")) { //this operation forces a cache clean freeing any lock -> windows only issue! WindowCache.reconfigure(new WindowCacheConfig()); } FileUtils.delete(gitDir, FileUtils.RECURSIVE | FileUtils.RETRY); } catch (java.io.IOException e) { throw new org.uberfire.java.nio.IOException("Failed to remove the git repository.", e); } }
@Override public void start() { final WindowCacheConfig c = new WindowCacheConfig(); c.fromConfig(cfg); WindowCache.reconfigure(c); }
@Override public void start() { final WindowCacheConfig c = new WindowCacheConfig(); c.fromConfig(cfg); WindowCache.reconfigure(c); }
@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(); } }
WindowCacheConfig cfg = new WindowCacheConfig(); cfg.install(); git.getRepository().close();
private boolean deleteFS(final FileSystem fileSystem) { final File gitDir = ((JGitFileSystemImpl) fileSystem).getGit().getRepository().getDirectory(); fileSystem.close(); fileSystem.dispose(); try { if (System.getProperty("os.name").toLowerCase().contains("windows")) { //this operation forces a cache clean freeing any lock -> windows only issue! WindowCache.reconfigure(new WindowCacheConfig()); } FileUtils.delete(gitDir, FileUtils.RECURSIVE | FileUtils.RETRY); fsManager.remove(fileSystem.getName()); cleanupParentDir(gitDir); return true; } catch (java.io.IOException e) { throw new IOException("Failed to remove the git repository.", e); } }
@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(); }
committer = new PersonIdent("J. Committer", "jcommitter@example.com"); final WindowCacheConfig c = new WindowCacheConfig(); c.setPackedGitLimit(128 * WindowCacheConfig.KB); c.setPackedGitWindowSize(8 * WindowCacheConfig.KB);
@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(); }
new WindowCacheConfig().fromConfig(cfg).install(); packConfig.fromConfig(cfg);
@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(); } }
WindowCacheConfig cfg = new WindowCacheConfig(); cfg.setPackedGitMMAP( false ); cfg.install();
WindowCacheConfig cfg = new WindowCacheConfig(); cfg.setPackedGitMMAP( false ); cfg.install();