// fail for example when the index contains unmerged paths
// (unresolved conflicts)
ObjectId indexTreeId = index.writeTree(odi);
// Create a Commit object, populate it and write it
Commit commit = new Commit(repo);
commit.setCommitter(committer);
commit.setAuthor(author);
commit.setMessage(message);
commit.setParentIds(parents.toArray(new ObjectId[] {}));
commit.setTreeId(indexTreeId);
ObjectId commitId = odi.insert(Constants.OBJ_COMMIT, odi
.format(commit));
odi.flush();
RevWalk revWalk = new RevWalk(repo);