|
|
@ -43,6 +43,14 @@ |
|
|
|
|
|
|
|
|
|
|
|
package org.eclipse.jgit.storage.file; |
|
|
|
package org.eclipse.jgit.storage.file; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_CORE_SECTION; |
|
|
|
|
|
|
|
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_DELTA_BASE_CACHE_LIMIT; |
|
|
|
|
|
|
|
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_PACKED_GIT_LIMIT; |
|
|
|
|
|
|
|
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_PACKED_GIT_MMAP; |
|
|
|
|
|
|
|
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_PACKED_GIT_OPENFILES; |
|
|
|
|
|
|
|
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_PACKED_GIT_WINDOWSIZE; |
|
|
|
|
|
|
|
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_STREAM_FILE_TRESHOLD; |
|
|
|
|
|
|
|
|
|
|
|
import org.eclipse.jgit.internal.storage.file.WindowCache; |
|
|
|
import org.eclipse.jgit.internal.storage.file.WindowCache; |
|
|
|
import org.eclipse.jgit.lib.Config; |
|
|
|
import org.eclipse.jgit.lib.Config; |
|
|
|
import org.eclipse.jgit.storage.pack.PackConfig; |
|
|
|
import org.eclipse.jgit.storage.pack.PackConfig; |
|
|
@ -227,20 +235,20 @@ public class WindowCacheConfig { |
|
|
|
* @since 3.0 |
|
|
|
* @since 3.0 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public WindowCacheConfig fromConfig(Config rc) { |
|
|
|
public WindowCacheConfig fromConfig(Config rc) { |
|
|
|
setPackedGitOpenFiles(rc.getInt( |
|
|
|
setPackedGitOpenFiles(rc.getInt(CONFIG_CORE_SECTION, null, |
|
|
|
"core", null, "packedgitopenfiles", getPackedGitOpenFiles())); //$NON-NLS-1$ //$NON-NLS-2$
|
|
|
|
CONFIG_KEY_PACKED_GIT_OPENFILES, getPackedGitOpenFiles())); |
|
|
|
setPackedGitLimit(rc.getLong( |
|
|
|
setPackedGitLimit(rc.getLong(CONFIG_CORE_SECTION, null, |
|
|
|
"core", null, "packedgitlimit", getPackedGitLimit())); //$NON-NLS-1$ //$NON-NLS-2$
|
|
|
|
CONFIG_KEY_PACKED_GIT_LIMIT, getPackedGitLimit())); |
|
|
|
setPackedGitWindowSize(rc.getInt( |
|
|
|
setPackedGitWindowSize(rc.getInt(CONFIG_CORE_SECTION, null, |
|
|
|
"core", null, "packedgitwindowsize", getPackedGitWindowSize())); //$NON-NLS-1$ //$NON-NLS-2$
|
|
|
|
CONFIG_KEY_PACKED_GIT_WINDOWSIZE, getPackedGitWindowSize())); |
|
|
|
setPackedGitMMAP(rc.getBoolean( |
|
|
|
setPackedGitMMAP(rc.getBoolean(CONFIG_CORE_SECTION, null, |
|
|
|
"core", null, "packedgitmmap", isPackedGitMMAP())); //$NON-NLS-1$ //$NON-NLS-2$
|
|
|
|
CONFIG_KEY_PACKED_GIT_MMAP, isPackedGitMMAP())); |
|
|
|
setDeltaBaseCacheLimit(rc.getInt( |
|
|
|
setDeltaBaseCacheLimit(rc.getInt(CONFIG_CORE_SECTION, null, |
|
|
|
"core", null, "deltabasecachelimit", getDeltaBaseCacheLimit())); //$NON-NLS-1$ //$NON-NLS-2$
|
|
|
|
CONFIG_KEY_DELTA_BASE_CACHE_LIMIT, getDeltaBaseCacheLimit())); |
|
|
|
|
|
|
|
|
|
|
|
long maxMem = Runtime.getRuntime().maxMemory(); |
|
|
|
long maxMem = Runtime.getRuntime().maxMemory(); |
|
|
|
long sft = rc.getLong( |
|
|
|
long sft = rc.getLong(CONFIG_CORE_SECTION, null, |
|
|
|
"core", null, "streamfilethreshold", getStreamFileThreshold()); //$NON-NLS-1$ //$NON-NLS-2$
|
|
|
|
CONFIG_KEY_STREAM_FILE_TRESHOLD, getStreamFileThreshold()); |
|
|
|
sft = Math.min(sft, maxMem / 4); // don't use more than 1/4 of the heap
|
|
|
|
sft = Math.min(sft, maxMem / 4); // don't use more than 1/4 of the heap
|
|
|
|
sft = Math.min(sft, Integer.MAX_VALUE); // cannot exceed array length
|
|
|
|
sft = Math.min(sft, Integer.MAX_VALUE); // cannot exceed array length
|
|
|
|
setStreamFileThreshold((int) sft); |
|
|
|
setStreamFileThreshold((int) sft); |
|
|
|