{# Latest commit panel (specify rounded-t-md so background does not cover border) #}
{!
// Get latest commit
struct object_id oid;
if (repo_get_oid(the_repository, ctx.qry.head, &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);
!}
{{ info->author }}
object.oid), ctx.qry.vpath); !}" class="ml-2 text-gray-500 hover:text-blue-600 hover:underline">{{ info->subject }}
object.oid), ctx.qry.vpath); !}" class="font-mono hover:text-blue-600 hover:underline">
{! short_commit_id(oid_to_hex(&commit->object.oid)); !}
·
{! cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2); !} ago
{# Files #}
{!
const struct object_id *tree_oid = get_commit_tree_oid(commit);
struct tree *tree = parse_tree_indirect(tree_oid);
struct pathspec paths = {
.nr = 0
};
read_tree(the_repository, tree, &paths, ls_item, NULL);
!}
{% if ctx.repo->readme.nr > 0 %}
{!
char *filename = ctx.repo->readme.items[0].string;
char *ref = ctx.repo->readme.items[0].util;
!}
{# Readme panel #}
{% endif %}
{# Heroicons micro book-open #}
{{ filename }}
{# Readme content #}
{!
cgit_open_filter(ctx.repo->about_filter, filename);
if (ref) {
cgit_print_file(filename, ref, 1);
} else {
html_include(filename);
}
cgit_close_filter(ctx.repo->about_filter);
!}