/*
* The tag page, which shows a single ref under refs/tags and is where the
* branch and tag listings link. An annotated tag is a git object in its own
* right, so its page carries the tagger, the date and the message, while a
* lightweight tag is only a name for a commit and gets a shorter table. Both
* forms link the object the tag points at and, when the repository enables
* snapshots, offer the tree at that tag for download as an archive.
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "cgit.h"
#include "filter.h"
#include "gpg-interface.h"
#include "html.h"
#include "parsing.h"
#include "shared.h"
#include "ui-shared.h"
#include "ui-tag.h"
static void print_name_row(const char *revname, const struct object_id *oid)
{
html("
tag name
");
html_txt(revname);
if (oid)
htmlf(" (%s)", oid_to_hex(oid));
html("
");
// 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");
}
/*
* A snapshot is cut from a commit, so a tag of anything else offers none, as in
* the refs listing.
*/
static void print_download_row(const char *revname, const struct object *obj)
{
if (!ctx.repo->snapshots || obj->type != OBJ_COMMIT)
return;
html("
\n");
}
/*
* Cutting the subject and the signature out terminates the message in place,
* which is safe only 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, *body, *signature = NULL;
size_t len, start;
if (!msg)
return;
// git finds the signature of any kind it can sign with, PGP, SSH or
// X.509, and it goes in a fold after the message, since its armour
// would otherwise run on for more lines than the message itself.
len = strlen(msg);
start = parse_signed_buffer(msg, len);
if (start < len) {
signature = xstrdup(msg + start);
while (start > 0 && msg[start - 1] == '\n')
start--;
msg[start] = '\0';
}
html("