Merge branch 'stable-2.13'

* stable-2.13:
  Expose JGit repository cache configuration parameters

Change-Id: I20e1b00f06a641d1dc2c59e406b0df8ac9aeba9f
This commit is contained in:
David Pursehouse
2016-09-20 14:57:20 +02:00
2 changed files with 32 additions and 0 deletions

View File

@@ -1412,6 +1412,33 @@ that are merged have more than one common predecessor.
+
Default is true.
[[core.repositoryCacheCleanupDelay]]core.repositoryCacheCleanupDelay::
+
Delay between each periodic cleanup of expired repositories.
+
Values can be specified using standard time unit abbreviations (`ms`, `sec`,
`min`, etc.).
+
Set it to 0 in order to switch off cache expiration. If cache expiration is
switched off, the JVM can still evict cache entries when it is running low
on available heap memory.
+
Set it to -1 to automatically derive cleanup delay from
`core.repositoryCacheExpireAfter` (lowest value between 1/10 of
`core.repositoryCacheExpireAfter` and 10 minutes).
+
Default is -1.
[[core.repositoryCacheExpireAfter]]core.repositoryCacheExpireAfter::
+
Time an unused repository should expire and be evicted from the repository
cache.
+
Values can be specified using standard time unit abbreviations (`ms`, `sec`,
`min`, etc.).
+
Default is 1 hour.
[[database]]
=== Section database

View File

@@ -31,6 +31,7 @@ import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.RepositoryCache;
import org.eclipse.jgit.lib.RepositoryCache.FileKey;
import org.eclipse.jgit.lib.RepositoryCacheConfig;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.storage.file.WindowCacheConfig;
import org.eclipse.jgit.util.FS;
@@ -84,6 +85,10 @@ public class LocalDiskRepositoryManager implements GitRepositoryManager,
@Override
public void start() {
RepositoryCacheConfig repoCacheCfg = new RepositoryCacheConfig();
repoCacheCfg.fromConfig(serverConfig);
repoCacheCfg.install();
WindowCacheConfig cfg = new WindowCacheConfig();
cfg.fromConfig(serverConfig);
if (serverConfig.getString("core", null, "streamFileThreshold") == null) {