diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2018-03-04 10:42:46 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2018-04-13 20:27:26 -0400 |
commit | e6375445d143d0335a9f5707e9bae1644cbef576 (patch) | |
tree | 7710149eca87e7ed6cf0ab7262e209bb4ff1479a /org.eclipse.jgit.pgm/src | |
parent | 5b0129641eb7627c63afd5a81e7fde0d2aed1355 (diff) | |
download | jgit-e6375445d143d0335a9f5707e9bae1644cbef576.tar.gz jgit-e6375445d143d0335a9f5707e9bae1644cbef576.zip |
Configure WindowCache settings to use in JGit CLI
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>
Diffstat (limited to 'org.eclipse.jgit.pgm/src')
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java index 75612be753..33c5475d10 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java @@ -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() { |