From bef36c8f1f305d137dd59d642c0a3c036fc5743d Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Mon, 16 Mar 2009 18:16:10 -0700 Subject: [PATCH] Teach WindowCacheConfig to read core.packedgit* settings from config This may help applications which want to read configuration from the current repository, or from ~/.gitconfig when picking the access strategy for the current process. Signed-off-by: Shawn O. Pearce Signed-off-by: Robin Rosenberg --- .../src/org/spearce/jgit/lib/WindowCacheConfig.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCacheConfig.java b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCacheConfig.java index d906a7c2..ea281642 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCacheConfig.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCacheConfig.java @@ -151,4 +151,20 @@ public class WindowCacheConfig { public void setDeltaBaseCacheLimit(final int newLimit) { deltaBaseCacheLimit = newLimit; } + + /** + * Update properties by setting fields from the configuration. + *

+ * If a property is not defined in the configuration, then it is left + * unmodified. + * + * @param rc configuration to read properties from. + */ + public void fromConfig(final RepositoryConfig rc) { + setPackedGitOpenFiles(rc.getInt("core", null, "packedgitopenfiles", getPackedGitOpenFiles())); + setPackedGitLimit(rc.getInt("core", null, "packedgitlimit", getPackedGitLimit())); + setPackedGitWindowSize(rc.getInt("core", null, "packedgitwindowsize", getPackedGitWindowSize())); + setPackedGitMMAP(rc.getBoolean("core", null, "packedgitmmap", isPackedGitMMAP())); + setDeltaBaseCacheLimit(rc.getInt("core", null, "deltabasecachelimit", getDeltaBaseCacheLimit())); + } } -- 2.11.4.GIT