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