Fix typo in constant name CONFIG_KEY_STREAM_FILE_TRESHOLD

Since it's part of the API deprecate the wrong spelling and add the
correct one with the same value.

Change-Id: I0f6ea95a5e66c9e80142eb6d40eb7ec3a7aaf8e2
This commit is contained in:
Matthias Sohn 2023-11-15 16:02:43 +01:00
parent 4aaf8cad90
commit 91c9146224
3 changed files with 15 additions and 6 deletions

View File

@ -14,7 +14,7 @@
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_DFS_SECTION; import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_DFS_SECTION;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_DELTA_BASE_CACHE_LIMIT; import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_DELTA_BASE_CACHE_LIMIT;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_STREAM_BUFFER; import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_STREAM_BUFFER;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_STREAM_FILE_TRESHOLD; import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_STREAM_FILE_THRESHOLD;
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;
@ -157,7 +157,7 @@ public DfsReaderOptions fromConfig(Config rc) {
long sft = rc.getLong( long sft = rc.getLong(
CONFIG_CORE_SECTION, CONFIG_CORE_SECTION,
CONFIG_DFS_SECTION, CONFIG_DFS_SECTION,
CONFIG_KEY_STREAM_FILE_TRESHOLD, CONFIG_KEY_STREAM_FILE_THRESHOLD,
getStreamFileThreshold()); 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

View File

@ -337,8 +337,17 @@ public final class ConfigConstants {
*/ */
public static final String CONFIG_KEY_SYMLINKS = "symlinks"; public static final String CONFIG_KEY_SYMLINKS = "symlinks";
/** The "streamFileThreshold" key */ /**
public static final String CONFIG_KEY_STREAM_FILE_TRESHOLD = "streamFileThreshold"; * The "streamFileThreshold" key
*
* @since 6.8
*/
public static final String CONFIG_KEY_STREAM_FILE_THRESHOLD = "streamFileThreshold";
/**
* @Deprecated typo, use CONFIG_KEY_STREAM_FILE_THRESHOLD instead
*/
public static final String CONFIG_KEY_STREAM_FILE_TRESHOLD = CONFIG_KEY_STREAM_FILE_THRESHOLD;
/** /**
* The "packedGitMmap" key * The "packedGitMmap" key

View File

@ -16,7 +16,7 @@
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_PACKED_GIT_MMAP; 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_OPENFILES;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_PACKED_GIT_WINDOWSIZE; 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 static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_STREAM_FILE_THRESHOLD;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_PACKED_GIT_USE_STRONGREFS; import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_PACKED_GIT_USE_STRONGREFS;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_PACKED_INDEX_GIT_USE_STRONGREFS; import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_PACKED_INDEX_GIT_USE_STRONGREFS;
@ -314,7 +314,7 @@ public WindowCacheConfig fromConfig(Config rc) {
long maxMem = Runtime.getRuntime().maxMemory(); long maxMem = Runtime.getRuntime().maxMemory();
long sft = rc.getLong(CONFIG_CORE_SECTION, null, long sft = rc.getLong(CONFIG_CORE_SECTION, null,
CONFIG_KEY_STREAM_FILE_TRESHOLD, getStreamFileThreshold()); CONFIG_KEY_STREAM_FILE_THRESHOLD, 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);