- html("<tr><th>tree</th><td colspan='2' class='sha1'><a href='");
- html_attr(cgit_pageurl(cgit_query_repo, "tree", fmt("id=%s", sha1_to_hex(commit->tree->object.sha1))));
- htmlf("'>%s</a></td></tr>\n", sha1_to_hex(commit->tree->object.sha1));
-
- for (p = commit->parents; p ; p = p->next) {
- html("<tr><th>parent</th><td colspan='2' class='sha1'><a href='");
- html_attr(cgit_pageurl(cgit_query_repo, "commit", fmt("id=%s", sha1_to_hex(p->item->object.sha1))));
- htmlf("'>%s</a></td></tr>\n",
- sha1_to_hex(p->item->object.sha1));
+ 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;
+ }
+ html("<tr><th>parent</th>"
+ "<td colspan='2' class='sha1'>");
+ tmp = tmp2 = oid_to_hex(&p->item->object.oid);
+ if (ctx.repo->enable_subject_links) {
+ parent_info = cgit_parse_commit(parent);
+ tmp2 = parent_info->subject;
+ }
+ cgit_commit_link(tmp2, NULL, NULL, ctx.qry.head, tmp, prefix);
+ html(" (");
+ cgit_diff_link("diff", NULL, NULL, ctx.qry.head, hex,
+ oid_to_hex(&p->item->object.oid), prefix);
+ html(")</td></tr>");
+ parents++;
+ }
+ if (ctx.repo->snapshots) {
+ html("<tr><th>download</th><td colspan='2' class='sha1'>");
+ cgit_print_snapshot_links(ctx.repo, hex, "<br/>");
+ html("</td></tr>");