| @@ -12,62 +12,30 @@ · 11 unmodified lines |
| 12 | 12 | #include "ui-log.h" |
| 13 | 13 | #include "ui-refs.h" |
| 14 | 14 | #include "ui-blob.h" |
| 15 | +#include "ui-shared.h" |
| 15 | 16 | #include <libgen.h> |
| 16 | 17 | |
| 17 | | −static void print_url(char *base, char *suffix) |
| 18 | +static int urls; |
| 19 | + |
| 20 | +static void print_url(const char *url) |
| 18 | 21 | { |
| 19 | 22 | int columns = 3; |
| 20 | | − struct strbuf basebuf = STRBUF_INIT; |
| 21 | 23 | |
| 22 | 24 | if (ctx.repo->enable_log_filecount) |
| 23 | 25 | columns++; |
| 24 | 26 | if (ctx.repo->enable_log_linecount) |
| 25 | 27 | columns++; |
| 26 | 28 | |
| 27 | | − if (!base || !*base) |
| 28 | | − return; |
| 29 | | − if (suffix && *suffix) { |
| 30 | | − strbuf_addf(&basebuf, "%s/%s", base, suffix); |
| 31 | | − base = basebuf.buf; |
| 29 | + if (urls++ == 0) { |
| 30 | + htmlf("<tr class='nohover'><td colspan='%d'> </td></tr>", columns); |
| 31 | + htmlf("<tr><th class='left' colspan='%d'>Clone</th></tr>\n", columns); |
| 32 | 32 | } |
| 33 | + |
| 33 | 34 | htmlf("<tr><td colspan='%d'><a href='", columns); |
| 34 | | − html_url_path(base); |
| 35 | + html_url_path(url); |
| 35 | 36 | html("'>"); |
| 36 | | − html_txt(base); |
| 37 | + html_txt(url); |
| 37 | 38 | html("</a></td></tr>\n"); |
| 38 | | − strbuf_release(&basebuf); |
| 39 | | −} |
| 40 | | − |
| 41 | | −static void print_urls(char *txt, char *suffix) |
| 42 | | −{ |
| 43 | | − char *h = txt, *t, c; |
| 44 | | − int urls = 0; |
| 45 | | − int columns = 3; |
| 46 | | − |
| 47 | | − if (ctx.repo->enable_log_filecount) |
| 48 | | − columns++; |
| 49 | | − if (ctx.repo->enable_log_linecount) |
| 50 | | − columns++; |
| 51 | | − |
| 52 | | − |
| 53 | | − while (h && *h) { |
| 54 | | − while (h && *h == ' ') |
| 55 | | − h++; |
| 56 | | − if (!*h) |
| 57 | | − break; |
| 58 | | − t = h; |
| 59 | | − while (t && *t && *t != ' ') |
| 60 | | − t++; |
| 61 | | − c = *t; |
| 62 | | − *t = 0; |
| 63 | | − if (urls++ == 0) { |
| 64 | | − htmlf("<tr class='nohover'><td colspan='%d'> </td></tr>", columns); |
| 65 | | − htmlf("<tr><th class='left' colspan='%d'>Clone</th></tr>\n", columns); |
| 66 | | − } |
| 67 | | − print_url(h, suffix); |
| 68 | | − *t = c; |
| 69 | | − h = t; |
| 70 | | − } |
| 71 | 39 | } |
| 72 | 40 | |
| 73 | 41 | void cgit_print_summary() |
| @@ -88,10 +56,8 @@ void cgit_print_summary() · 14 unmodified lines |
| 88 | 56 | cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL, |
| 89 | 57 | NULL, NULL, 0, 0, 0); |
| 90 | 58 | } |
| 91 | | − if (ctx.repo->clone_url) |
| 92 | | − print_urls(expand_macros(ctx.repo->clone_url), NULL); |
| 93 | | − else if (ctx.cfg.clone_prefix) |
| 94 | | − print_urls(ctx.cfg.clone_prefix, ctx.repo->url); |
| 59 | + urls = 0; |
| 60 | + cgit_add_clone_urls(print_url); |
| 95 | 61 | html("</table>"); |
| 96 | 62 | } |
| 97 | 63 | |