{! int cgit_refs_cmp_branch_age(const void *a, const void *b); !} {! int cgit_refs_cmp_ref_name(const void *a, const void *b); !} {! int cgit_refs_cmp_tag_age(const void *a, const void *b); !} {% page cgit_print_refs %} {! page_start(); !} {! repo_header(); !}
{# Main content #}
{# Description panel #} {{ ctx.repo->desc }}
{% if !ctx.qry.path || starts_with(ctx.qry.path, "heads") %} {! struct reflist list; list.refs = NULL; list.alloc = list.count = 0; refs_for_each_branch_ref(get_main_ref_store(the_repository), cgit_refs_cb, &list); qsort(list.refs, list.count, sizeof(*list.refs), cgit_refs_cmp_branch_age); if (ctx.repo->branch_sort == 0) { qsort(list.refs, list.count, sizeof(*list.refs), cgit_refs_cmp_ref_name); } !}
{# Branches list #}
Branches
{% for int i = 0; i < list.count; i++ %} {! struct refinfo *ref = list.refs[i]; !} {! struct commitinfo *info = ref->commit; !} {! char *name = (char *)ref->refname; !} {! if (!info) { continue; } !}
{{ name }}
{% if ref->object->type == OBJ_COMMIT %}
{{ info->subject }} · Updated {! cgit_print_age(info->committer_date, info->committer_tz, -1); !} ago {{ info->author }}
{% endif %}
{% endfor %}
{! cgit_free_reflist_inner(&list); !} {% endif %} {% if !ctx.qry.path || starts_with(ctx.qry.path, "tags") %} {! struct reflist list; list.refs = NULL; list.alloc = list.count = 0; refs_for_each_tag_ref(get_main_ref_store(the_repository), cgit_refs_cb, &list); !} {% if list.count > 0 %} {! qsort(list.refs, list.count, sizeof(*list.refs), cgit_refs_cmp_tag_age); !}
{# Tags list #}
Tags
{% for int i = 0; i < list.count; i++ %} {! struct refinfo *ref = list.refs[i]; struct tag *tag = NULL; struct taginfo *info = NULL; char *name = (char *)ref->refname; struct object *obj = ref->object; if (obj->type == OBJ_TAG) { tag = (struct tag *)obj; obj = tag->tagged; info = ref->tag; if (!info) { continue; } } !}
{{ name }}
{% if info && (info->tagger_date > 0 || info->tagger) %}
{% if info->tagger_date > 0 %} Updated {! cgit_print_age(info->tagger_date, info->tagger_tz, -1); !} ago {% endif %} {% if info->tagger %} {{ info->tagger }} {% endif %}
{% elif ref->object->type == OBJ_COMMIT %}
Updated {! cgit_print_age(ref->commit->commit->date, 0, -1); !} ago {{ ref->commit->author }}
{% endif %}
{% endfor %}
{! cgit_free_reflist_inner(&list); !} {% endif %}{# if list.count > 0 #} {% endif %}{# if !ctx.qry.path || starts_with(ctx.qry.path, "tags") #}
{! page_end(); !} {% endpage %}