From 14680f6e6e9c8bd5e0640699f2a501c3fc8db178 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 27 Jul 2011 06:34:52 -0700 Subject: [PATCH] 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 --- .../eclipse/jgit/storage/pack/PackConfig.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) 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. * -- 2.39.5