{! #include "../ui-blob.h" !} {% block ls_item_impl(const struct object_id *oid, struct strbuf *base, const char *pathname, unsigned mode, void *cbdata) %} {! unsigned long size = 0; if (!S_ISGITLINK(mode)) { oid_object_info(the_repository, oid, &size); } !}
{% if S_ISDIR(mode) %} {# Heroicons solid folder #} {% else %} {# Heroicons outline document #} {% endif %}
{{ pathname }}
{! cgit_print_filemode(mode); !}
{% if !S_ISDIR(mode) %}{{ size|%ld }}{% endif %}
{% endblock %} {! int ls_item(const struct object_id *oid, struct strbuf *base, const char *pathname, unsigned mode, void *cbdata) { ls_item_impl(oid, base, pathname, mode, cbdata); return 0; } !} {% block cgit_print_summary_impl %} {! page_start(); !} {! repo_header(); !}
{# Main content #} {! repo_description_panel(); !} {! repo_summary_bar(); !}
{# Latest commit panel (specify rounded-t-md so background does not cover border) #} {! 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); !} {! cgit_free_commitinfo(info); !} {# 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 #}
{# 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); !}
{% endif %}
{! page_end(); !} {% endblock %} {% page cgit_print_summary %} {! cgit_print_summary_impl(); !} {% endpage %}