.format("Existing ref {0} points to a {1} ({2}) instead of a commmit",
ref.getRef(), ref.getObject().getType(),
ref.getObject().getSha()));
// Write tree
Tree tree;
try {
int size = entries.size();
if (size != 1)
info(MessageFormat.format(
"Creating tree with {0} blob entries", size));
else
info("Creating tree with 1 blob entry");
String baseTree = null;
if (merge && ref != null) {
Tree currentTree = service.getCommit(repository,
ref.getObject().getSha()).getTree();
if (currentTree != null)
baseTree = currentTree.getSha();
info(MessageFormat.format("Merging with tree {0}", baseTree));
}
if (!dryRun)
tree = service.createTree(repository, entries, baseTree);
else
tree = new Tree();
} catch (IOException e) {
throw new MojoExecutionException("Error creating tree: "
+ getExceptionMessage(e), e);
}