]> source.dussan.org Git - jgit.git/commitdiff
Configure WindowCache settings to use in JGit CLI 95/118595/3
authorMatthias Sohn <matthias.sohn@sap.com>
Sun, 4 Mar 2018 09:42:46 +0000 (10:42 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Sat, 14 Apr 2018 00:27:26 +0000 (20:27 -0400)
Set the same defaults as in EGit.
Use mmap to map git packfiles into memory.

Change-Id: I7997b9123448a762192d7eeb55e01432549fba98
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java

index 75612be7534197f24de0e62e63a5d3b47b0433d6..33c5475d103bf48f0ce03806b07603d0588c29d5 100644 (file)
@@ -71,6 +71,7 @@ import org.eclipse.jgit.lib.RepositoryBuilder;
 import org.eclipse.jgit.pgm.internal.CLIText;
 import org.eclipse.jgit.pgm.opt.CmdLineParser;
 import org.eclipse.jgit.pgm.opt.SubcommandHandler;
+import org.eclipse.jgit.storage.file.WindowCacheConfig;
 import org.eclipse.jgit.transport.HttpTransport;
 import org.eclipse.jgit.transport.http.apache.HttpClientConnectionFactory;
 import org.eclipse.jgit.util.CachedAuthenticator;
@@ -105,10 +106,19 @@ public class Main {
 
        private ExecutorService gcExecutor;
 
+       private static final int MB = 1024 * 1024;
+
        /**
         * <p>Constructor for Main.</p>
         */
        public Main() {
+               final WindowCacheConfig c = new WindowCacheConfig();
+               c.setPackedGitMMAP(true);
+               c.setPackedGitWindowSize(8 * 1024);
+               c.setPackedGitLimit(10 * MB);
+               c.setDeltaBaseCacheLimit(10 * MB);
+               c.setStreamFileThreshold(50 * MB);
+               c.install();
                HttpTransport.setConnectionFactory(new HttpClientConnectionFactory());
                BuiltinLFS.register();
                gcExecutor = Executors.newSingleThreadExecutor(new ThreadFactory() {