// create a merge commit and a reference to track the merge commit
ObjectId treeId = merger.getResultTreeId();
ObjectInserter odi = repository.newObjectInserter();
try {
// Create a commit object
CommitBuilder commitBuilder = new CommitBuilder();
commitBuilder.setCommitter(committer);
commitBuilder.setAuthor(committer);
commitBuilder.setEncoding(Constants.CHARSET);
if (StringUtils.isEmpty(message)) {
message = MessageFormat.format("merge {0} into {1}", srcTip.getName(), branchTip.getName());
}
commitBuilder.setMessage(message);
commitBuilder.setParentIds(branchTip.getId(), srcTip.getId());
commitBuilder.setTreeId(treeId);
// Insert the merge commit into the repository
ObjectId mergeCommitId = odi.insert(commitBuilder);
odi.flush();