Website Summary Files Commits Branches @commit @diff @stats
path: root / ui-refs.c
diff options
context:
space:
mode:
Commit63aa2ecd4e72800c11b08e4fb94234a117ece029 (patch)
Author
 Syndamia <kamen@syndamia.com>
2026-09-27 22:04:58 +0300
Committer
 Syndamia <kamen@syndamia.com>
2026-09-27 22:17:41 +0300
Filesf399e7b86e2c450adc2a62b517af100db65c1b73 /ui-refs.c
cgit-63aa2ecd4e72800c11b08e4fb94234a117ece029.tar
cgit-63aa2ecd4e72800c11b08e4fb94234a117ece029.tar.gz
cgit-63aa2ecd4e72800c11b08e4fb94234a117ece029.zip
Parent59125deae6522ca335a16c84a67e57e85edb88d6 (diff)
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
1 files changed, 46 insertions, 0 deletions
-rw-r--r--ui-refs.c46
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("<tr class='nohover'><th class='left'>Branch</th>"
+ "<th class='left'>Age</th></tr>\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("<tr><td>");
+ cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL,
+ ctx.qry.showmsg, 0);
+ html("</td><td>");
+ cgit_print_age(info->committer_date, info->committer_tz, -1);
+ html("</td></tr>\n");
+ }
+
+ if (maxcount < list.count)
+ print_refs_link("heads");
+
+ cgit_free_reflist_inner(&list);
+}
+
void cgit_print_tags(int maxcount)
{
struct reflist list;