|
|
|
@ -191,7 +191,7 @@ public class PackFileTest extends LocalDiskRepositoryTestCase {
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testDelta_SmallObjectChain() throws Exception { |
|
|
|
|
ObjectInserter.Formatter fmt = new ObjectInserter.Formatter(); |
|
|
|
|
try (ObjectInserter.Formatter fmt = new ObjectInserter.Formatter()) { |
|
|
|
|
byte[] data0 = new byte[512]; |
|
|
|
|
Arrays.fill(data0, (byte) 0xf3); |
|
|
|
|
ObjectId id0 = fmt.idFor(Constants.OBJ_BLOB, data0); |
|
|
|
@ -247,10 +247,11 @@ public class PackFileTest extends LocalDiskRepositoryTestCase {
|
|
|
|
|
assertEquals("stream at EOF", -1, in.read()); |
|
|
|
|
in.close(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testDelta_FailsOver2GiB() throws Exception { |
|
|
|
|
ObjectInserter.Formatter fmt = new ObjectInserter.Formatter(); |
|
|
|
|
try (ObjectInserter.Formatter fmt = new ObjectInserter.Formatter()) { |
|
|
|
|
byte[] base = new byte[] { 'a' }; |
|
|
|
|
ObjectId idA = fmt.idFor(Constants.OBJ_BLOB, base); |
|
|
|
|
ObjectId idB = fmt.idFor(Constants.OBJ_BLOB, new byte[] { 'b' }); |
|
|
|
@ -274,7 +275,8 @@ public class PackFileTest extends LocalDiskRepositoryTestCase {
|
|
|
|
|
deflate(pack, delta); |
|
|
|
|
byte[] footer = digest(pack); |
|
|
|
|
|
|
|
|
|
File dir = new File(repo.getObjectDatabase().getDirectory(), "pack"); |
|
|
|
|
File dir = new File(repo.getObjectDatabase().getDirectory(), |
|
|
|
|
"pack"); |
|
|
|
|
File packName = new File(dir, idA.name() + ".pack"); |
|
|
|
|
File idxName = new File(dir, idA.name() + ".idx"); |
|
|
|
|
|
|
|
|
@ -306,6 +308,7 @@ public class PackFileTest extends LocalDiskRepositoryTestCase {
|
|
|
|
|
packFile.close(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static byte[] clone(int first, byte[] base) { |
|
|
|
|
byte[] r = new byte[base.length]; |
|
|
|
|