|
|
@ -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<>(); |
|
|
|
blobs.add(testRepo.blob(genDeltableData(1000))); |
|
|
|
try (TestRepository<FileRepository> testRepo = new TestRepository<>( |
|
|
|
blobs.add(testRepo.blob(genDeltableData(1005))); |
|
|
|
repo)) { |
|
|
|
|
|
|
|
blobs.add(testRepo.blob(genDeltableData(1000))); |
|
|
|
|
|
|
|
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,25 +537,23 @@ 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, |
|
|
|
contentA.getId())); |
|
|
|
Arrays.asList(c1.getId(), c1.getTree().getId(), |
|
|
|
contentB = testRepo.blob("B"); |
|
|
|
contentA.getId())); |
|
|
|
c2 = bb.commit().add("f", contentB).create(); |
|
|
|
contentB = testRepo.blob("B"); |
|
|
|
testRepo.getRevWalk().parseHeaders(c2); |
|
|
|
c2 = bb.commit().add("f", contentB).create(); |
|
|
|
PackIndex pf2 = writePack(repo, wants(c2), |
|
|
|
testRepo.getRevWalk().parseHeaders(c2); |
|
|
|
Sets.of((ObjectIdSet) pf1)); |
|
|
|
PackIndex pf2 = writePack(repo, wants(c2), Sets.of((ObjectIdSet) pf1)); |
|
|
|
assertContent(pf2, Arrays.asList(c2.getId(), c2.getTree().getId(), |
|
|
|
assertContent( |
|
|
|
contentB.getId())); |
|
|
|
pf2, |
|
|
|
} |
|
|
|
Arrays.asList(c2.getId(), c2.getTree().getId(), |
|
|
|
|
|
|
|
contentB.getId())); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void assertContent(PackIndex pi, List<ObjectId> expected) { |
|
|
|
private static void assertContent(PackIndex pi, List<ObjectId> expected) { |
|
|
@ -660,20 +660,21 @@ 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"); |
|
|
|
contentC = r.blob("C"); |
|
|
|
contentC = r.blob("C"); |
|
|
|
contentD = r.blob("D"); |
|
|
|
contentD = r.blob("D"); |
|
|
|
contentE = r.blob("E"); |
|
|
|
contentE = r.blob("E"); |
|
|
|
c1 = bb.commit().add("a", contentA).create(); |
|
|
|
c1 = bb.commit().add("a", contentA).create(); |
|
|
|
c2 = bb.commit().add("b", contentB).create(); |
|
|
|
c2 = bb.commit().add("b", contentB).create(); |
|
|
|
c3 = bb.commit().add("c", contentC).create(); |
|
|
|
c3 = bb.commit().add("c", contentC).create(); |
|
|
|
c4 = bb.commit().add("d", contentD).create(); |
|
|
|
c4 = bb.commit().add("d", contentD).create(); |
|
|
|
c5 = bb.commit().add("e", contentE).create(); |
|
|
|
c5 = bb.commit().add("e", contentE).create(); |
|
|
|
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, |
|
|
|