{! #include "../ui-diff.h" !} {% page cgit_print_commit %} {! char *hex = ctx.qry.oid; if (!hex) { hex = ctx.qry.head; } struct object_id oid; if (repo_get_oid(the_repository, hex, &oid)) { die("Bad object id"); } struct commit *commit = lookup_commit_reference(the_repository, &oid); if (!commit) { die("Bad commit reference"); } struct commitinfo *info = cgit_parse_commit(commit); ctx.page.title = fmtalloc("%s - %s", info->subject, ctx.page.title); !} {! page_start(); !} {! repo_header(); !}
{# Main content #} {! repo_description_panel(); !} {! repo_summary_bar(); !}
{# Commit info box #}
{{ info->author }} {! cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2); !} ago
{! char short_commit_id[8]; !} {% for struct commit_list *p = commit->parents; p; p = p->next %} {! struct commit *parent = lookup_commit_reference(the_repository, &p->item->object.oid); !} {% if parent %} {! memcpy(short_commit_id, oid_to_hex(&p->item->object.oid), 7); !} {! short_commit_id[7] = '\0'; !} parent item->object.oid) }}" class="font-mono text-blue-500 hover:text-blue-600 hover:underline">{{ short_commit_id }} · {% endif %} {% endfor %} {! memcpy(short_commit_id, oid_to_hex(&commit->object.oid), 7); !} {! short_commit_id[7] = '\0'; !} commit object.oid) }}" class="font-mono text-blue-500 hover:text-blue-600 hover:underline">{{ short_commit_id }}
{# Diff panel #} {! cgit_print_diff(ctx.qry.oid, NULL, NULL, 0, 0); !}
{! cgit_free_commitinfo(info); !} {! page_end(); !} {% endpage %}