|
|
@ -469,10 +469,12 @@ public class PackWriterTest extends SampleDataRepositoryTestCase { |
|
|
|
public void testDeltaStatistics() throws Exception { |
|
|
|
public void testDeltaStatistics() throws Exception { |
|
|
|
config.setDeltaCompress(true); |
|
|
|
config.setDeltaCompress(true); |
|
|
|
FileRepository repo = createBareRepository(); |
|
|
|
FileRepository repo = createBareRepository(); |
|
|
|
TestRepository<FileRepository> testRepo = new TestRepository<>(repo); |
|
|
|
|
|
|
|
ArrayList<RevObject> blobs = new ArrayList<>(); |
|
|
|
ArrayList<RevObject> blobs = new ArrayList<>(); |
|
|
|
|
|
|
|
try (TestRepository<FileRepository> testRepo = new TestRepository<>( |
|
|
|
|
|
|
|
repo)) { |
|
|
|
blobs.add(testRepo.blob(genDeltableData(1000))); |
|
|
|
blobs.add(testRepo.blob(genDeltableData(1000))); |
|
|
|
blobs.add(testRepo.blob(genDeltableData(1005))); |
|
|
|
blobs.add(testRepo.blob(genDeltableData(1005))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try (PackWriter pw = new PackWriter(repo)) { |
|
|
|
try (PackWriter pw = new PackWriter(repo)) { |
|
|
|
NullProgressMonitor m = NullProgressMonitor.INSTANCE; |
|
|
|
NullProgressMonitor m = NullProgressMonitor.INSTANCE; |
|
|
@ -535,26 +537,24 @@ public class PackWriterTest extends SampleDataRepositoryTestCase { |
|
|
|
public void testExclude() throws Exception { |
|
|
|
public void testExclude() throws Exception { |
|
|
|
FileRepository repo = createBareRepository(); |
|
|
|
FileRepository repo = createBareRepository(); |
|
|
|
|
|
|
|
|
|
|
|
TestRepository<FileRepository> testRepo = new TestRepository<>( |
|
|
|
try (TestRepository<FileRepository> testRepo = new TestRepository<>( |
|
|
|
repo); |
|
|
|
repo)) { |
|
|
|
BranchBuilder bb = testRepo.branch("refs/heads/master"); |
|
|
|
BranchBuilder bb = testRepo.branch("refs/heads/master"); |
|
|
|
contentA = testRepo.blob("A"); |
|
|
|
contentA = testRepo.blob("A"); |
|
|
|
c1 = bb.commit().add("f", contentA).create(); |
|
|
|
c1 = bb.commit().add("f", contentA).create(); |
|
|
|
testRepo.getRevWalk().parseHeaders(c1); |
|
|
|
testRepo.getRevWalk().parseHeaders(c1); |
|
|
|
PackIndex pf1 = writePack(repo, wants(c1), EMPTY_ID_SET); |
|
|
|
PackIndex pf1 = writePack(repo, wants(c1), EMPTY_ID_SET); |
|
|
|
assertContent( |
|
|
|
assertContent(pf1, Arrays.asList(c1.getId(), c1.getTree().getId(), |
|
|
|
pf1, |
|
|
|
|
|
|
|
Arrays.asList(c1.getId(), c1.getTree().getId(), |
|
|
|
|
|
|
|
contentA.getId())); |
|
|
|
contentA.getId())); |
|
|
|
contentB = testRepo.blob("B"); |
|
|
|
contentB = testRepo.blob("B"); |
|
|
|
c2 = bb.commit().add("f", contentB).create(); |
|
|
|
c2 = bb.commit().add("f", contentB).create(); |
|
|
|
testRepo.getRevWalk().parseHeaders(c2); |
|
|
|
testRepo.getRevWalk().parseHeaders(c2); |
|
|
|
PackIndex pf2 = writePack(repo, wants(c2), Sets.of((ObjectIdSet) pf1)); |
|
|
|
PackIndex pf2 = writePack(repo, wants(c2), |
|
|
|
assertContent( |
|
|
|
Sets.of((ObjectIdSet) pf1)); |
|
|
|
pf2, |
|
|
|
assertContent(pf2, Arrays.asList(c2.getId(), c2.getTree().getId(), |
|
|
|
Arrays.asList(c2.getId(), c2.getTree().getId(), |
|
|
|
|
|
|
|
contentB.getId())); |
|
|
|
contentB.getId())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void assertContent(PackIndex pi, List<ObjectId> expected) { |
|
|
|
private static void assertContent(PackIndex pi, List<ObjectId> expected) { |
|
|
|
assertEquals("Pack index has wrong size.", expected.size(), |
|
|
|
assertEquals("Pack index has wrong size.", expected.size(), |
|
|
@ -660,7 +660,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase { |
|
|
|
|
|
|
|
|
|
|
|
private FileRepository setupRepoForShallowFetch() throws Exception { |
|
|
|
private FileRepository setupRepoForShallowFetch() throws Exception { |
|
|
|
FileRepository repo = createBareRepository(); |
|
|
|
FileRepository repo = createBareRepository(); |
|
|
|
TestRepository<Repository> r = new TestRepository<>(repo); |
|
|
|
try (TestRepository<Repository> r = new TestRepository<>(repo)) { |
|
|
|
BranchBuilder bb = r.branch("refs/heads/master"); |
|
|
|
BranchBuilder bb = r.branch("refs/heads/master"); |
|
|
|
contentA = r.blob("A"); |
|
|
|
contentA = r.blob("A"); |
|
|
|
contentB = r.blob("B"); |
|
|
|
contentB = r.blob("B"); |
|
|
@ -675,6 +675,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase { |
|
|
|
r.getRevWalk().parseHeaders(c5); // fully initialize the tip RevCommit
|
|
|
|
r.getRevWalk().parseHeaders(c5); // fully initialize the tip RevCommit
|
|
|
|
return repo; |
|
|
|
return repo; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static PackIndex writePack(FileRepository repo, |
|
|
|
private static PackIndex writePack(FileRepository repo, |
|
|
|
Set<? extends ObjectId> want, Set<ObjectIdSet> excludeObjects) |
|
|
|
Set<? extends ObjectId> want, Set<ObjectIdSet> excludeObjects) |
|
|
|