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;
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);
}
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
*/
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;
* {@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>
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;
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. */
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;