From 63aa2ecd4e72800c11b08e4fb94234a117ece029 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 27 Sep 2026 22:04:58 +0300 Subject: ui-summary: (THEME) Rework what is shown in summary page Now clone and branches are shown next to commits and tags, branches only show name and age, clone does not create links, and file listing (alongside readme) is shown below --- ui-refs.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'ui-refs.c') diff --git a/ui-refs.c b/ui-refs.c index 11fb9fc..455f09c 100644 --- a/ui-refs.c +++ b/ui-refs.c @@ -179,6 +179,52 @@ void cgit_print_branches(int maxcount) cgit_free_reflist_inner(&list); } +void cgit_print_branches_component(int maxcount) +{ + struct reflist list; + int i; + struct commitinfo *info; + char *name; + + html("Branch" + "Age\n"); + + list.refs = NULL; + list.alloc = list.count = 0; + refs_for_each_branch_ref(get_main_ref_store(the_repository), + cgit_refs_cb, &list); + if (ctx.repo->enable_remote_branches) + refs_for_each_remote_ref(get_main_ref_store(the_repository), + cgit_refs_cb, &list); + + if (maxcount == 0 || maxcount > list.count) + maxcount = list.count; + + qsort(list.refs, list.count, sizeof(*list.refs), cmp_branch_age); + if (ctx.repo->branch_sort == 0) + qsort(list.refs, maxcount, sizeof(*list.refs), cmp_ref_name); + + for (i = 0; i < maxcount; i++) { + info = list.refs[i]->commit; + name = (char *)list.refs[i]->refname; + + if (!info || list.refs[i]->object->type != OBJ_COMMIT) + continue; + + html(""); + cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL, + ctx.qry.showmsg, 0); + html(""); + cgit_print_age(info->committer_date, info->committer_tz, -1); + html("\n"); + } + + if (maxcount < list.count) + print_refs_link("heads"); + + cgit_free_reflist_inner(&list); +} + void cgit_print_tags(int maxcount) { struct reflist list; -- cgit v1.3.1-23-gd82d