- html("<tr><th>tree</th><td colspan='2' class='sha1'><a href='");
- query = fmt("id=%s", sha1_to_hex(commit->tree->object.sha1));
- html_attr(cgit_pageurl(cgit_query_repo, "tree", query));
- htmlf("'>%s</a></td></tr>\n", sha1_to_hex(commit->tree->object.sha1));
- for (p = commit->parents; p ; p = p->next) {
+ html("<tr><th>commit</th><td colspan='2' class='sha1'>");
+ tmp = oid_to_hex(&commit->object.oid);
+ cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, prefix);
+ html(" (");
+ cgit_patch_link("patch", NULL, NULL, NULL, tmp, prefix);
+ html(")</td></tr>\n");
+ html("<tr><th>tree</th><td colspan='2' class='sha1'>");
+ tmp = xstrdup(hex);
+ cgit_tree_link(oid_to_hex(get_commit_tree_oid(commit)), NULL, NULL,
+ ctx.qry.head, tmp, NULL);
+ if (prefix) {
+ html(" /");
+ cgit_tree_link(prefix, NULL, NULL, ctx.qry.head, tmp, prefix);
+ }
+ free(tmp);
+ html("</td></tr>\n");
+ for (p = commit->parents; p; p = p->next) {
+ parent = lookup_commit_reference(the_repository, &p->item->object.oid);
+ if (!parent) {
+ html("<tr><td colspan='3'>");
+ cgit_print_error("Error reading parent commit");
+ html("</td></tr>");
+ continue;
+ }