about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJohn Keeping2018-03-31 15:11:05 +0100
committerJason A. Donenfeld2018-06-27 18:11:19 +0200
commit71d14d9c98c39a6683780060f84429a3a7e5b348 (patch)
tree12c3a446f63c1e8ed756ffc8a76b4e4daa4f5d6b
parentui-shared: pass separator in to cgit_print_snapshot_links() (diff)
downloadcgit-71d14d9c98c39a6683780060f84429a3a7e5b348.tar.gz
cgit-71d14d9c98c39a6683780060f84429a3a7e5b348.zip
ui-refs: use shared function to print tag downloads
cgit_compose_snapshot_prefix() is identical to print_tag_downloads(), so
remove the latter and use the function from ui-shared.c instead.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
-rw-r--r--ui-refs.c27
1 files changed, 1 insertions, 26 deletions
diff --git a/ui-refs.c b/ui-refs.c index 7b95e8b..2ec3858 100644 --- a/ui-refs.c +++ b/ui-refs.c
@@ -90,31 +90,6 @@ static void print_tag_header(void)
90 "<th class='left' colspan='2'>Age</th></tr>\n"); 90 "<th class='left' colspan='2'>Age</th></tr>\n");
91} 91}
92 92
93static void print_tag_downloads(const struct cgit_repo *repo, const char *ref)
94{
95 const struct cgit_snapshot_format* f;
96 const char *basename;
97 struct strbuf filename = STRBUF_INIT;
98 size_t prefixlen;
99
100 basename = cgit_snapshot_prefix(repo);
101 if (starts_with(ref, basename))
102 strbuf_addstr(&filename, ref);
103 else
104 cgit_compose_snapshot_prefix(&filename, basename, ref);
105 prefixlen = filename.len;
106 for (f = cgit_snapshot_formats; f->suffix; f++) {
107 if (!(repo->snapshots & f->bit))
108 continue;
109 strbuf_setlen(&filename, prefixlen);
110 strbuf_addstr(&filename, f->suffix);
111 cgit_snapshot_link(filename.buf, NULL, NULL, NULL, NULL, filename.buf);
112 html("&nbsp;&nbsp;");
113 }
114
115 strbuf_release(&filename);
116}
117
118static int print_tag(struct refinfo *ref) 93static int print_tag(struct refinfo *ref)
119{ 94{
120 struct tag *tag = NULL; 95 struct tag *tag = NULL;
@@ -134,7 +109,7 @@ static int print_tag(struct refinfo *ref)
134 cgit_tag_link(name, NULL, NULL, name); 109 cgit_tag_link(name, NULL, NULL, name);
135 html("</td><td>"); 110 html("</td><td>");
136 if (ctx.repo->snapshots && (obj->type == OBJ_COMMIT)) 111 if (ctx.repo->snapshots && (obj->type == OBJ_COMMIT))
137 print_tag_downloads(ctx.repo, name); 112 cgit_print_snapshot_links(ctx.repo, name, "&nbsp;&nbsp;");
138 else 113 else
139 cgit_object_link(obj); 114 cgit_object_link(obj);
140 html("</td><td>"); 115 html("</td><td>");