Browse Source

Merge branch 'stable-5.1' into stable-5.2

* stable-5.1:
  Replace usage of ArrayIndexOutOfBoundsException in treewalk
  Add config constants for WindowCache configuration options

Change-Id: I17da3c5183eca536aa2be3972bc5df45c9d75f1b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-5.2
David Pursehouse 5 years ago committed by Matthias Sohn
parent
commit
0d962eaa78
  1. 24
      org.eclipse.jgit/.settings/.api_filters
  2. 24
      org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
  3. 32
      org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCacheConfig.java
  4. 6
      org.eclipse.jgit/src/org/eclipse/jgit/treewalk/AbstractTreeIterator.java
  5. 9
      org.eclipse.jgit/src/org/eclipse/jgit/treewalk/CanonicalTreeParser.java

24
org.eclipse.jgit/.settings/.api_filters

@ -63,6 +63,30 @@
<message_argument value="CONFIG_JMX_SECTION"/> <message_argument value="CONFIG_JMX_SECTION"/>
</message_arguments> </message_arguments>
</filter> </filter>
<filter id="1142947843">
<message_arguments>
<message_argument value="5.1.13"/>
<message_argument value="CONFIG_KEY_PACKED_GIT_LIMIT"/>
</message_arguments>
</filter>
<filter id="1142947843">
<message_arguments>
<message_argument value="5.1.13"/>
<message_argument value="CONFIG_KEY_PACKED_GIT_MMAP"/>
</message_arguments>
</filter>
<filter id="1142947843">
<message_arguments>
<message_argument value="5.1.13"/>
<message_argument value="CONFIG_KEY_PACKED_GIT_OPENFILES"/>
</message_arguments>
</filter>
<filter id="1142947843">
<message_arguments>
<message_argument value="5.1.13"/>
<message_argument value="CONFIG_KEY_PACKED_GIT_WINDOWSIZE"/>
</message_arguments>
</filter>
<filter id="1142947843"> <filter id="1142947843">
<message_arguments> <message_arguments>
<message_argument value="5.1.9"/> <message_argument value="5.1.9"/>

24
org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java

@ -230,6 +230,30 @@ public final class ConfigConstants {
/** The "streamFileThreshold" key */ /** The "streamFileThreshold" key */
public static final String CONFIG_KEY_STREAM_FILE_TRESHOLD = "streamFileThreshold"; public static final String CONFIG_KEY_STREAM_FILE_TRESHOLD = "streamFileThreshold";
/**
* The "packedGitMmap" key
* @since 5.1.13
*/
public static final String CONFIG_KEY_PACKED_GIT_MMAP = "packedgitmmap";
/**
* The "packedGitWindowSize" key
* @since 5.1.13
*/
public static final String CONFIG_KEY_PACKED_GIT_WINDOWSIZE = "packedgitwindowsize";
/**
* The "packedGitLimit" key
* @since 5.1.13
*/
public static final String CONFIG_KEY_PACKED_GIT_LIMIT = "packedgitlimit";
/**
* The "packedGitOpenFiles" key
* @since 5.1.13
*/
public static final String CONFIG_KEY_PACKED_GIT_OPENFILES = "packedgitopenfiles";
/** The "remote" key */ /** The "remote" key */
public static final String CONFIG_KEY_REMOTE = "remote"; public static final String CONFIG_KEY_REMOTE = "remote";

32
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCacheConfig.java

@ -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);

6
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/AbstractTreeIterator.java

@ -239,12 +239,10 @@ public abstract class AbstractTreeIterator {
path = p.path; path = p.path;
pathOffset = p.pathLen + 1; pathOffset = p.pathLen + 1;
try { if (pathOffset > path.length) {
path[pathOffset - 1] = '/';
} catch (ArrayIndexOutOfBoundsException e) {
growPath(p.pathLen); growPath(p.pathLen);
path[pathOffset - 1] = '/';
} }
path[pathOffset - 1] = '/';
} }
/** /**

9
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/CanonicalTreeParser.java

@ -387,14 +387,13 @@ public class CanonicalTreeParser extends AbstractTreeIterator {
tmp = pathOffset; tmp = pathOffset;
for (;; tmp++) { for (;; tmp++) {
c = raw[ptr++]; c = raw[ptr++];
if (c == 0) if (c == 0) {
break; break;
try { }
path[tmp] = c; if (tmp >= path.length) {
} catch (ArrayIndexOutOfBoundsException e) {
growPath(tmp); growPath(tmp);
path[tmp] = c;
} }
path[tmp] = c;
} }
pathLen = tmp; pathLen = tmp;
nextPtr = ptr + OBJECT_ID_LENGTH; nextPtr = ptr + OBJECT_ID_LENGTH;

Loading…
Cancel
Save