{// simulate a commit so the repo head points to this new tree
ObjectInserter objectInserter = repo.newObjectInserter();
List<ObjectId> parents = ImmutableList.of();
RevCommit commit = new CommitBuilder().setTreeId(newRepoTreeId1).setParentIds(parents)
.build();
ObjectId commitId = commit.getId();
objectInserter.insert(commit);
Optional<Ref> newHead = geogig.command(UpdateRef.class).setName("refs/heads/master")
.setNewValue(commitId).call();
assertTrue(newHead.isPresent());
}
final ObjectId newRepoTreeId2;
{
// write comparing the the previously generated tree instead of the repository HEAD, as
// it was not updated (no commit op was performed)
newRepoTreeId2 = geogig.command(WriteTree2.class).setOldRoot(tree(newRepoTreeId1))
.call();
// assertEquals(index.getDatabase().getStagedRootRef().getObjectId(), newRepoTreeId2);
System.err.println("++++++++ new root 2:" + newRepoTreeId2 + " ++++++++++");
RevTree newRepoTree = repo.getTree(newRepoTreeId2);
// check feature1_2, feature1_2 and feature2_1
Optional<Node> treeChild;
assertNotNull(treeChild = repo.getTreeChild(newRepoTree, appendChild(pointsName, idP2)));
assertEquals(oId1_2, treeChild.get().getObjectId());
assertNotNull(treeChild = repo.getTreeChild(newRepoTree, appendChild(pointsName, idP3)));
assertEquals(oId1_3, treeChild.get().getObjectId());
assertNotNull(treeChild = repo.getTreeChild(newRepoTree, appendChild(linesName, idL1)));
assertEquals(oId2_1, treeChild.get().getObjectId());
// as well as feature1_1 from the previous commit
assertNotNull(treeChild = repo.getTreeChild(newRepoTree, appendChild(pointsName, idP1)));
assertEquals(oId1_1, treeChild.get().getObjectId());
}
{// simulate a commit so the repo head points to this new tree
ObjectInserter objectInserter = repo.newObjectInserter();
List<ObjectId> parents = ImmutableList.of();
RevCommit commit = new CommitBuilder().setTreeId(newRepoTreeId2).setParentIds(parents)
.build();
ObjectId commitId = commit.getId();
objectInserter.insert(commit);
Optional<Ref> newHead = geogig.command(UpdateRef.class).setName("refs/heads/master")