summaryrefslogtreecommitdiffabout
authorAlexey Nezhdanov <snakeru@gmail.com>2009-09-27 19:00:29 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2009-10-06 17:26:06 (UTC)
commit8cdccac758d976a8a92cc39b1581832a889e2058 (patch) (side-by-side diff)
tree49dddea4e0a025a834f62218668f257212908b85
parent121898e73d6e28656c2d451effc6d9907ebdc5ba (diff)
downloadcgit-8cdccac758d976a8a92cc39b1581832a889e2058.zip
cgit-8cdccac758d976a8a92cc39b1581832a889e2058.tar.gz
cgit-8cdccac758d976a8a92cc39b1581832a889e2058.tar.bz2
ui-tag: add snapshot links
Signed-off-by: Alexey Nezhdanov <snakeru@gmail.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--ui-tag.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ui-tag.c b/ui-tag.c
index c2d72af..cd353c2 100644
--- a/ui-tag.c
+++ b/ui-tag.c
@@ -17,32 +17,40 @@ static void print_tag_content(char *buf)
if (!buf)
return;
html("<div class='commit-subject'>");
p = strchr(buf, '\n');
if (p)
*p = '\0';
html_txt(buf);
html("</div>");
if (p) {
html("<div class='commit-msg'>");
html_txt(++p);
html("</div>");
}
}
+void print_download_links(char *revname)
+{
+ html("<tr><th>download</th><td class='sha1'>");
+ cgit_print_snapshot_links(ctx.qry.repo, ctx.qry.head,
+ revname, ctx.repo->snapshots);
+ html("</td></tr>");
+}
+
void cgit_print_tag(char *revname)
{
unsigned char sha1[20];
struct object *obj;
struct tag *tag;
struct taginfo *info;
if (!revname)
revname = ctx.qry.head;
if (get_sha1(fmt("refs/tags/%s", revname), sha1)) {
cgit_print_error(fmt("Bad tag reference: %s", revname));
return;
}
obj = parse_object(sha1);
if (!obj) {
@@ -63,30 +71,34 @@ void cgit_print_tag(char *revname)
html("<tr><td>Tag date</td><td>");
cgit_print_date(info->tagger_date, FMT_LONGDATE, ctx.cfg.local_time);
html("</td></tr>\n");
}
if (info->tagger) {
html("<tr><td>Tagged by</td><td>");
html_txt(info->tagger);
if (info->tagger_email && !ctx.cfg.noplainemail) {
html(" ");
html_txt(info->tagger_email);
}
html("</td></tr>\n");
}
html("<tr><td>Tagged object</td><td>");
cgit_object_link(tag->tagged);
html("</td></tr>\n");
+ if (ctx.repo->snapshots)
+ print_download_links(revname);
html("</table>\n");
print_tag_content(info->msg);
} else {
html("<table class='commit-info'>\n");
htmlf("<tr><td>Tag name</td><td>");
html_txt(revname);
html("</td></tr>\n");
html("<tr><td>Tagged object</td><td>");
cgit_object_link(obj);
html("</td></tr>\n");
+ if (ctx.repo->snapshots)
+ print_download_links(revname);
html("</table>\n");
}
return;
}