]>
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 static void print_download_links(char *revname
)
35 html("<tr><th>download</th><td class='sha1'>");
36 cgit_print_snapshot_links(ctx
.qry
.repo
, ctx
.qry
.head
,
37 revname
, ctx
.repo
->snapshots
);
41 void cgit_print_tag(char *revname
)
43 unsigned char sha1
[20];
49 revname
= ctx
.qry
.head
;
51 if (get_sha1(fmt("refs/tags/%s", revname
), sha1
)) {
52 cgit_print_error(fmt("Bad tag reference: %s", revname
));
55 obj
= parse_object(sha1
);
57 cgit_print_error(fmt("Bad object id: %s", sha1_to_hex(sha1
)));
60 if (obj
->type
== OBJ_TAG
) {
61 tag
= lookup_tag(sha1
);
62 if (!tag
|| parse_tag(tag
) || !(info
= cgit_parse_tag(tag
))) {
63 cgit_print_error(fmt("Bad tag object: %s", revname
));
66 html("<table class='commit-info'>\n");
67 htmlf("<tr><td>tag name</td><td>");
69 htmlf(" (%s)</td></tr>\n", sha1_to_hex(sha1
));
70 if (info
->tagger_date
> 0) {
71 html("<tr><td>tag date</td><td>");
72 cgit_print_date(info
->tagger_date
, FMT_LONGDATE
, ctx
.cfg
.local_time
);
76 html("<tr><td>tagged by</td><td>");
77 html_txt(info
->tagger
);
78 if (info
->tagger_email
&& !ctx
.cfg
.noplainemail
) {
80 html_txt(info
->tagger_email
);
84 html("<tr><td>tagged object</td><td class='sha1'>");
85 cgit_object_link(tag
->tagged
);
87 if (ctx
.repo
->snapshots
)
88 print_download_links(revname
);
90 print_tag_content(info
->msg
);
92 html("<table class='commit-info'>\n");
93 htmlf("<tr><td>tag name</td><td>");
96 html("<tr><td>Tagged object</td><td class='sha1'>");
97 cgit_object_link(obj
);
99 if (ctx
.repo
->snapshots
)
100 print_download_links(revname
);