private MkRepoCommit commit(
@NotNull(message = "json can't be NULL") final JsonObject json
) throws IOException {
final String sha = fakeSha();
// @checkstyle MultipleStringLiterals (40 lines)
final Directives commit = new Directives().xpath(this.commitXpath())
.add("commit")
.add("sha").set(sha).up()
.add("url").set("http://localhost/4").up()
.add("html_url").set("http://localhost/5").up()
.add("message").set(json.getString("message")).up();
if (json.containsKey("committer")) {
final JsonObject committer = json.getJsonObject("committer");
commit.add("committer")
.add("email").set(committer.getString("email")).up()
.add("name").set(committer.getString("name")).up();
}
if (json.containsKey("author")) {
final JsonObject author = json.getJsonObject("author");
commit.add("author")
.add("email").set(author.getString("email")).up()
.add("name").set(author.getString("name")).up();
}
this.storage.apply(commit);
return new MkRepoCommit(this.storage, this.repo(), sha);