in java/com/google/gitiles/CommitSoyData.java [78:156]
Map<String, Object> toSoyData(
HttpServletRequest req, RevWalk walk, RevCommit c, Set<Field> fs, DateFormatter df)
throws IOException {
GitilesView view = ViewFilter.getView(req);
if (cdb == null) {
cdb = new CommitData.Builder();
}
CommitData cd = cdb.setArchiveFormat(archiveFormat).build(req, walk, c, fs);
Map<String, Object> data = Maps.newHashMapWithExpectedSize(fs.size());
if (cd.author != null) {
data.put("author", toSoyData(cd.author, df));
}
if (cd.committer != null) {
data.put("committer", toSoyData(cd.committer, df));
}
if (cd.sha != null) {
data.put("sha", cd.sha.name());
}
if (cd.abbrev != null) {
data.put("abbrevSha", cd.abbrev.name());
}
if (cd.url != null) {
data.put("url", cd.url);
}
if (cd.logUrl != null) {
data.put("logUrl", cd.logUrl);
}
if (cd.archiveUrl != null) {
data.put("archiveUrl", cd.archiveUrl);
}
if (cd.archiveType != null) {
data.put("archiveType", cd.archiveType.getShortName());
}
if (cd.tree != null) {
data.put("tree", cd.tree.name());
}
if (cd.treeUrl != null) {
data.put("treeUrl", cd.treeUrl);
}
if (cd.parents != null) {
data.put("parents", toSoyData(view, fs, cd.parents));
}
if (cd.shortMessage != null) {
data.put("shortMessage", cd.shortMessage);
}
if (cd.branches != null) {
data.put("branches", toSoyData(view, cd.branches, Constants.R_HEADS));
}
if (cd.tags != null) {
data.put("tags", toSoyData(view, cd.tags, Constants.R_TAGS));
}
if (cd.message != null) {
if (linkifier != null) {
data.put("message", linkifier.linkify(req, cd.message));
} else {
data.put("message", cd.message);
}
}
if (cd.diffEntries != null) {
data.put("diffTree", toSoyData(view, cd.diffEntries));
}
int diffSetSize = Sets.difference(fs, NESTED_FIELDS).size();
if (fs.contains(
Field.NOTES)) { // Since NOTES is optional this is required for checkState to pass
diffSetSize -= 1;
}
checkState(diffSetSize == data.size(), "bad commit data fields: %s != %s", fs, data.keySet());
if (cd.notes != null && !cd.notes.isEmpty()) {
data.put("notes", cd.notes);
}
return data;
}