assertTrue(childObject.isPresent());
}
// Merge master into Branch1
MergeOp merge = localGeogig.geogig.command(MergeOp.class);
MergeReport report = merge.addCommit(Suppliers.ofInstance(masterCommit))
.setMessage("Merge").call();
// Update master to the new merge commit
localGeogig.geogig.command(UpdateRef.class).setName("refs/heads/master")
.setNewValue(report.getMergeCommit().getId()).call();
// Checkout master
localGeogig.geogig.command(CheckoutOp.class).setSource("master").call();
PushOp push = push();
push.addRefSpec("refs/heads/master").call();
logs = remoteGeogig.geogig.command(LogOp.class).call();
List<RevCommit> logged = new ArrayList<RevCommit>();
for (; logs.hasNext();) {
logged.add(logs.next());
}
assertEquals("Merge", logged.get(0).getMessage());
assertFalse(report.getMergeCommit().getId().equals(logged.get(0).getId()));
// Although we merged "Roads.2" commit into the "Roads.3" commit, making the "Roads.2"
// commit the second parent, they should have been swapped when pushing to the full
// repository to prevent any sparse data from being lost.
ObjectId parent1Id = logged.get(0).getParentIds().get(0);
ObjectId parent2Id = logged.get(0).getParentIds().get(1);
RevCommit parent1 = remoteGeogig.geogig.getRepository().getCommit(parent1Id);
assertNotNull(parent1);
assertEquals("Roads.2", parent1.getMessage());
RevCommit parent2 = remoteGeogig.geogig.getRepository().getCommit(parent2Id);
assertNotNull(parent2);
assertEquals("Roads.3", parent2.getMessage());
// Verify they weren't swapped in the original
parent1Id = report.getMergeCommit().getParentIds().get(0);
parent2Id = report.getMergeCommit().getParentIds().get(1);
parent1 = localGeogig.geogig.getRepository().getCommit(parent1Id);
assertNotNull(parent1);
assertEquals("Roads.3", parent1.getMessage());
parent2 = localGeogig.geogig.getRepository().getCommit(parent2Id);