summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-09-06 11:37:29 -0400
committerCode Review <codereview-daemon@eclipse.org>2010-09-06 11:37:29 -0400
commit2b0c5c7207de5563aa29db79668f09ff9b36f056 (patch)
treed6a62b752d23edc2f63c5b9b0bcc8dc5bba5a0d1
parent8145e402332a236dae6e5b4e669fa4851581ed64 (diff)
parentb505e2a558132d2baf07e4992bc9686d80a63bcf (diff)
downloadjgit-2b0c5c7207de5563aa29db79668f09ff9b36f056.tar.gz
jgit-2b0c5c7207de5563aa29db79668f09ff9b36f056.zip
Merge "Use 5 MiB for RevWalk default limit"
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java15
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java15
2 files changed, 3 insertions, 27 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java
index d37973799c..249b95ec3c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java
@@ -47,7 +47,6 @@
package org.eclipse.jgit.lib;
import static java.util.zip.Deflater.DEFAULT_COMPRESSION;
-import static org.eclipse.jgit.lib.ObjectLoader.STREAM_THRESHOLD;
import org.eclipse.jgit.lib.Config.SectionParser;
@@ -68,21 +67,12 @@ public class CoreConfig {
private final boolean logAllRefUpdates;
- private final int streamFileThreshold;
-
private final boolean autoCRLF;
private CoreConfig(final Config rc) {
compression = rc.getInt("core", "compression", DEFAULT_COMPRESSION);
packIndexVersion = rc.getInt("pack", "indexversion", 2);
logAllRefUpdates = rc.getBoolean("core", "logallrefupdates", true);
-
- long maxMem = Runtime.getRuntime().maxMemory();
- long sft = rc.getLong("core", null, "streamfilethreshold", STREAM_THRESHOLD);
- 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
- streamFileThreshold = (int) sft;
-
autoCRLF = rc.getBoolean("core", "autocrlf", false);
}
@@ -108,11 +98,6 @@ public class CoreConfig {
return logAllRefUpdates;
}
- /** @return the size threshold beyond which objects must be streamed. */
- public int getStreamFileThreshold() {
- return streamFileThreshold;
- }
-
/**
* @return whether automatic CRLF conversion has been configured
*/
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java
index dd513d8a95..94eb62106e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java
@@ -61,7 +61,6 @@ import org.eclipse.jgit.errors.RevWalkException;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.AsyncObjectLoaderQueue;
import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.CoreConfig;
import org.eclipse.jgit.lib.MutableObjectId;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectIdSubclassMap;
@@ -96,6 +95,8 @@ import org.eclipse.jgit.treewalk.filter.TreeFilter;
* {@link #next()} does not.
*/
public class RevWalk implements Iterable<RevCommit> {
+ private static final int MB = 1 << 20;
+
/**
* Set on objects whose important header data has been loaded.
* <p>
@@ -171,9 +172,6 @@ public class RevWalk implements Iterable<RevCommit> {
private final ObjectIdSubclassMap<RevObject> objects;
- /** Largest commit or annotated tag we are willing to touch. */
- private final int bigFileThreshold;
-
private int freeFlags = APP_FLAGS;
private int delayFreeFlags;
@@ -230,13 +228,6 @@ public class RevWalk implements Iterable<RevCommit> {
filter = RevFilter.ALL;
treeFilter = TreeFilter.ALL;
retainBody = true;
-
- if (repo != null) {
- CoreConfig cfg = repo.getConfig().get(CoreConfig.KEY);
- bigFileThreshold = cfg.getStreamFileThreshold();
- } else {
- bigFileThreshold = 15 * 1024 * 1024;
- }
}
/** @return the reader this walker is using to load objects. */
@@ -867,7 +858,7 @@ public class RevWalk implements Iterable<RevCommit> {
byte[] getCachedBytes(RevObject obj, ObjectLoader ldr)
throws LargeObjectException, MissingObjectException, IOException {
try {
- return ldr.getCachedBytes(bigFileThreshold);
+ return ldr.getCachedBytes(5 * MB);
} catch (LargeObjectException tooBig) {
tooBig.setObjectId(obj);
throw tooBig;