head = ids[0];
if (head == null || head.getBytes().length == 0) {
// assume virgin repository
byte[] rawHead = Id.fromLong(commitCounter.incrementAndGet())
.getBytes();
head = new Id(rawHead);
Id rootNodeId = pm.writeNode(new MutableNode(this));
MutableCommit initialCommit = new MutableCommit();
initialCommit.setCommitTS(System.currentTimeMillis());
initialCommit.setRootNodeId(rootNodeId);
pm.writeCommit(head, initialCommit);
pm.writeHead(head);
} else {
Id lastCommitId = head;
if (ids[1] != null && ids[1].compareTo(lastCommitId) > 0) {
lastCommitId = ids[1];
}
commitCounter.set(Long.parseLong(lastCommitId.toString(), 16));
}
if (gcpm != null) {
gcExecutor = Executors.newScheduledThreadPool(1,
new ThreadFactory() {