Browse Source

Merge "IndexPack: Remove blob-streaming size threshold"

stable-0.10
Shawn Pearce 14 years ago committed by Code Review
parent
commit
93a7b2b24d
  1. 1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/IndexPackTest.java
  2. 9
      org.eclipse.jgit/src/org/eclipse/jgit/transport/IndexPack.java

1
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/IndexPackTest.java

@ -166,7 +166,6 @@ public class IndexPackTest extends RepositoryTestCase {
final byte[] raw = pack.toByteArray(); final byte[] raw = pack.toByteArray();
IndexPack ip = IndexPack.create(db, new ByteArrayInputStream(raw)); IndexPack ip = IndexPack.create(db, new ByteArrayInputStream(raw));
ip.setStreamFileThreshold(1);
ip.index(NullProgressMonitor.INSTANCE); ip.index(NullProgressMonitor.INSTANCE);
ip.renameAndOpenPack(); ip.renameAndOpenPack();
} }

9
org.eclipse.jgit/src/org/eclipse/jgit/transport/IndexPack.java

@ -145,8 +145,6 @@ public class IndexPack {
private final Repository repo; private final Repository repo;
private int streamFileThreshold;
/** /**
* Object database used for loading existing objects * Object database used for loading existing objects
*/ */
@ -244,7 +242,6 @@ public class IndexPack {
public IndexPack(final Repository db, final InputStream src, public IndexPack(final Repository db, final InputStream src,
final File dstBase) throws IOException { final File dstBase) throws IOException {
repo = db; repo = db;
streamFileThreshold = 5 * (1 << 20); // A reasonable default for now.
objectDatabase = db.getObjectDatabase().newCachedDatabase(); objectDatabase = db.getObjectDatabase().newCachedDatabase();
in = src; in = src;
inflater = new InflaterStream(); inflater = new InflaterStream();
@ -268,10 +265,6 @@ public class IndexPack {
} }
} }
void setStreamFileThreshold(int sz) {
streamFileThreshold = sz;
}
/** /**
* Set the pack index file format version this instance will create. * Set the pack index file format version this instance will create.
* *
@ -860,7 +853,7 @@ public class IndexPack {
objectDigest.update((byte) 0); objectDigest.update((byte) 0);
boolean checkContentLater = false; boolean checkContentLater = false;
if (type == Constants.OBJ_BLOB && sz >= streamFileThreshold) { if (type == Constants.OBJ_BLOB) {
InputStream inf = inflate(Source.INPUT, sz); InputStream inf = inflate(Source.INPUT, sz);
long cnt = 0; long cnt = 0;
while (cnt < sz) { while (cnt < sz) {

Loading…
Cancel
Save