From: Shawn O. Pearce Date: Wed, 27 Jul 2011 13:34:52 +0000 (-0700) Subject: Add copy constructor to PackConfig X-Git-Tag: v1.1.0.201109011030-rc2~36 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fchanges%2F24%2F3924%2F1;p=jgit.git Add copy constructor to PackConfig Some embeddings of UploadPack (e.g. Gerrit Code Review) set their own PackConfig from a server-wide configuration, overriding any JGit defaults or settings that may exist at the local repository level. Make a copy constructor form of PackConfig so this server-wide configuration object can be copied and then merged with repository specific configuration data. Change-Id: I4463c95aeaf7d6536c3ab132dec9c50ee528d9e0 Signed-off-by: Shawn O. Pearce --- diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java index 7206bb8b0d..91275dc098 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java @@ -189,6 +189,29 @@ public class PackConfig { fromConfig(cfg); } + /** + * Copy an existing configuration to a new instance. + * + * @param cfg + * the source configuration to copy from. + */ + public PackConfig(PackConfig cfg) { + this.compressionLevel = cfg.compressionLevel; + this.reuseDeltas = cfg.reuseDeltas; + this.reuseObjects = cfg.reuseObjects; + this.deltaBaseAsOffset = cfg.deltaBaseAsOffset; + this.deltaCompress = cfg.deltaCompress; + this.maxDeltaDepth = cfg.maxDeltaDepth; + this.deltaSearchWindowSize = cfg.deltaSearchWindowSize; + this.deltaSearchMemoryLimit = cfg.deltaSearchMemoryLimit; + this.deltaCacheSize = cfg.deltaCacheSize; + this.deltaCacheLimit = cfg.deltaCacheLimit; + this.bigFileThreshold = cfg.bigFileThreshold; + this.threads = cfg.threads; + this.executor = cfg.executor; + this.indexVersion = cfg.indexVersion; + } + /** * Check whether to reuse deltas existing in repository. *