3 void cgit_print_commit(const char *hex)
6 struct commitinfo *info;
12 unsigned char sha1[20];
14 if (get_sha1(hex, sha1)) {
15 cgit_print_error(fmt("Bad object id: %s", hex));
19 buf = read_sha1_file(sha1, type, &size);
21 cgit_print_error(fmt("Bad object reference: %s", hex));
25 commit = lookup_commit(sha1);
27 cgit_print_error(fmt("Bad commit reference: %s", hex));
32 if (parse_commit_buffer(commit, buf, size)) {
33 cgit_print_error(fmt("Malformed commit buffer: %s", hex));
37 info = cgit_parse_commit(commit);
39 html("<table class='commit-info'>\n");
40 html("<tr><th>author</th><td colspan='2'>");
41 html_txt(info->author);
43 html("<tr><th>committer</th><td>");
44 html_txt(info->committer);
45 html("</td><td class='right'>");
46 cgit_print_date(commit->date);
48 html("<tr><th>tree</th><td colspan='2' class='sha1'><a href='");
49 html_attr(cgit_pageurl(cgit_query_repo, "tree", fmt("id=%s", sha1_to_hex(commit->tree->object.sha1))));
50 htmlf("'>%s</a></td></tr>\n", sha1_to_hex(commit->tree->object.sha1));
52 for (p = commit->parents; p ; p = p->next) {
53 html("<tr><th>parent</th><td colspan='2' class='sha1'><a href='");
54 html_attr(cgit_pageurl(cgit_query_repo, "commit", fmt("id=%s", sha1_to_hex(p->item->object.sha1))));
55 htmlf("'>%s</a></td></tr>\n",
56 sha1_to_hex(p->item->object.sha1));
59 html("<div class='commit-subject'>");
60 html_txt(info->subject);
62 html("<div class='commit-msg'>");
66 free(info->committer);