aboutsummaryrefslogtreecommitdiffstats
path: root/ui-refs.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-refs.c')
-rw-r--r--ui-refs.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/ui-refs.c b/ui-refs.c
index 7eb16d5..d61ee7c 100644
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -79,12 +79,37 @@ static int print_branch(struct refinfo *ref)
79static void print_tag_header() 79static void print_tag_header()
80{ 80{
81 html("<tr class='nohover'><th class='left'>Tag</th>" 81 html("<tr class='nohover'><th class='left'>Tag</th>"
82 "<th class='left'>Reference</th>" 82 "<th class='left'>Download</th>"
83 "<th class='left'>Author</th>" 83 "<th class='left'>Author</th>"
84 "<th class='left' colspan='2'>Age</th></tr>\n"); 84 "<th class='left' colspan='2'>Age</th></tr>\n");
85 header = 1; 85 header = 1;
86} 86}
87 87
88static void print_tag_downloads(const struct cgit_repo *repo, const char *ref)
89{
90 const struct cgit_snapshot_format* f;
91 char *filename;
92 const char *basename;
93
94 if (!ref || strlen(ref) < 2)
95 return;
96
97 basename = cgit_repobasename(repo->url);
98 if (prefixcmp(ref, basename) != 0) {
99 if ((ref[0] == 'v' || ref[0] == 'V') && isdigit(ref[1]))
100 ref++;
101 if (isdigit(ref[0]))
102 ref = xstrdup(fmt("%s-%s", basename, ref));
103 }
104
105 for (f = cgit_snapshot_formats; f->suffix; f++) {
106 if (!(repo->snapshots & f->bit))
107 continue;
108 filename = fmt("%s%s", ref, f->suffix);
109 cgit_snapshot_link(filename, NULL, NULL, NULL, NULL, filename);
110 html("&nbsp;&nbsp;");
111 }
112}
88static int print_tag(struct refinfo *ref) 113static int print_tag(struct refinfo *ref)
89{ 114{
90 struct tag *tag; 115 struct tag *tag;
@@ -99,7 +124,10 @@ static int print_tag(struct refinfo *ref)
99 html("<tr><td>"); 124 html("<tr><td>");
100 cgit_tag_link(name, NULL, NULL, ctx.qry.head, name); 125 cgit_tag_link(name, NULL, NULL, ctx.qry.head, name);
101 html("</td><td>"); 126 html("</td><td>");
102 cgit_object_link(tag->tagged); 127 if (ctx.repo->snapshots && (tag->tagged->type == OBJ_COMMIT))
128 print_tag_downloads(ctx.repo, name);
129 else
130 cgit_object_link(tag->tagged);
103 html("</td><td>"); 131 html("</td><td>");
104 if (info->tagger) 132 if (info->tagger)
105 html(info->tagger); 133 html(info->tagger);
@@ -113,7 +141,10 @@ static int print_tag(struct refinfo *ref)
113 html("<tr><td>"); 141 html("<tr><td>");
114 html_txt(name); 142 html_txt(name);
115 html("</td><td>"); 143 html("</td><td>");
116 cgit_object_link(ref->object); 144 if (ctx.repo->snapshots && (tag->tagged->type == OBJ_COMMIT))
145 print_tag_downloads(ctx.repo, name);
146 else
147 cgit_object_link(ref->object);
117 html("</td></tr>\n"); 148 html("</td></tr>\n");
118 } 149 }
119 return 0; 150 return 0;