From 7721ec50853daaafd2999337d9ae198abcea9a1c Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Tue, 15 Sep 2026 18:05:47 -1000 Subject: Lay the tag table out like the commit table --- source/ui-tag.c | 78 ++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 31 deletions(-) (limited to 'source/ui-tag.c') diff --git a/source/ui-tag.c b/source/ui-tag.c index ec8cd54..02fbfc7 100644 --- a/source/ui-tag.c +++ b/source/ui-tag.c @@ -17,27 +17,62 @@ #include "ui-shared.h" #include "ui-tag.h" +// The rows share the commit page's three column layout, so a single value +// spans the name and date columns of the tagger row. +static void print_tag_row(const char *revname, const struct object_id *oid) +{ + html("tag"); + html_txt(revname); + if (oid) + htmlf(" (%s)", oid_to_hex(oid)); + html("\n"); +} + static void print_object_row(struct object *obj) { - html("tagged object"); + html("object"); cgit_object_link(obj); html("\n"); } static void print_download_row(const char *revname) { - html("download"); + html("download"); cgit_print_snapshot_links(ctx.repo, revname, "
"); html("\n"); } +static void print_tagger_row(struct taginfo *info) +{ + html("tagger"); + // A tag can carry a tagger with no address, and a filter must not be + // handed a NULL argument. + cgit_open_filter(ctx.repo->email_filter, info->tagger_email ? info->tagger_email : "", "tag"); + html_txt(info->tagger); + if (info->tagger_email && ctx.cfg.enable_plain_email) { + html(" "); + html_txt(info->tagger_email); + } + cgit_close_filter(ctx.repo->email_filter); + html(""); + if (info->tagger_date > 0) { + html(""); + } + html("\n"); +} + /* * Cutting the subject out terminates the message in place, which is safe only - * because the caller frees it straight after. + * because the caller frees it straight after. The blank lines between the + * subject and the body are skipped, as the commit page skips them. */ static void print_message(char *msg) { - char *newline; + char *newline, *body; if (!msg) return; @@ -49,8 +84,11 @@ static void print_message(char *msg) html_txt(msg); html(""); if (newline) { + body = newline + 1; + while (*body == '\n') + body++; html("
"); - html_txt(newline + 1); + html_txt(body); html("
"); } } @@ -68,29 +106,9 @@ static void print_annotated_tag(const char *revname, const struct object_id *oid cgit_print_layout_start(); html("\n"); - html("\n", oid_to_hex(oid)); - if (info->tagger_date > 0) { - html("\n"); - } - if (info->tagger) { - html("\n"); - } + if (info->tagger) + print_tagger_row(info); + print_tag_row(revname, oid); print_object_row(tag->tagged); if (ctx.repo->snapshots) print_download_row(revname); @@ -104,9 +122,7 @@ static void print_lightweight_tag(const char *revname, struct object *obj) { cgit_print_layout_start(); html("
tag name"); - html_txt(revname); - htmlf(" (%s)
tag date
tagged by"); - // A tag can carry a tagger with no address, and a filter must - // not be handed a NULL argument. - cgit_open_filter(ctx.repo->email_filter, info->tagger_email ? info->tagger_email : "", "tag"); - html_txt(info->tagger); - if (info->tagger_email && ctx.cfg.enable_plain_email) { - html(" "); - html_txt(info->tagger_email); - } - cgit_close_filter(ctx.repo->email_filter); - html("
\n"); - html("\n"); + print_tag_row(revname, NULL); print_object_row(obj); if (ctx.repo->snapshots) print_download_row(revname); -- cgit v2.8.0
tag name"); - html_txt(revname); - html("