]>
git.cameronkatri.com Git - cgit.git/blob - ui-tag.c
1 /* ui-tag.c: display a tag
3 * Copyright (C) 2007 Lars Hjemli
5 * Licensed under GNU General Public License v2
6 * (see COPYING for full license text)
11 #include "ui-shared.h"
13 static void print_tag_content(char *buf
)
20 html("<div class='commit-subject'>");
21 p
= strchr(buf
, '\n');
27 html("<div class='commit-msg'>");
33 void cgit_print_tag(char *revname
)
35 unsigned char sha1
[20];
40 if (get_sha1(revname
, sha1
)) {
41 cgit_print_error(fmt("Bad tag reference: %s", revname
));
44 obj
= parse_object(sha1
);
46 cgit_print_error(fmt("Bad object id: %s", sha1_to_hex(sha1
)));
49 if (obj
->type
== OBJ_TAG
) {
50 tag
= lookup_tag(sha1
);
51 if (!tag
|| parse_tag(tag
) || !(info
= cgit_parse_tag(tag
))) {
52 cgit_print_error(fmt("Bad tag object: %s", revname
));
55 html("<table class='commit-info'>\n");
56 htmlf("<tr><td>Tag name</td><td>");
58 htmlf(" (%s)</td></tr>\n", sha1_to_hex(sha1
));
59 if (info
->tagger_date
> 0) {
60 html("<tr><td>Tag date</td><td>");
61 cgit_print_date(info
->tagger_date
, FMT_LONGDATE
, ctx
.cfg
.local_time
);
65 html("<tr><td>Tagged by</td><td>");
66 html_txt(info
->tagger
);
67 if (info
->tagger_email
) {
69 html_txt(info
->tagger_email
);
73 html("<tr><td>Tagged object</td><td>");
74 cgit_object_link(tag
->tagged
);
77 print_tag_content(info
->msg
);
79 html("<table class='commit-info'>\n");
80 htmlf("<tr><td>Tag name</td><td>");
83 html("<tr><td>Tagged object</td><td>");
84 cgit_object_link(obj
);