| @@ -12,62 +12,30 @@ · 11 unmodified lines |
| 12 | #include "ui-log.h" | 12 | #include "ui-log.h" |
| 13 | #include "ui-refs.h" | 13 | #include "ui-refs.h" |
| 14 | #include "ui-blob.h" | 14 | #include "ui-blob.h" |
| | 15 | #include "ui-shared.h" |
| 15 | #include <libgen.h> | 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 | int columns = 3; | 22 | int columns = 3; |
| 20 | struct strbuf basebuf = STRBUF_INIT; | | |
| 21 | | 23 | |
| 22 | if (ctx.repo->enable_log_filecount) | 24 | if (ctx.repo->enable_log_filecount) |
| 23 | columns++; | 25 | columns++; |
| 24 | if (ctx.repo->enable_log_linecount) | 26 | if (ctx.repo->enable_log_linecount) |
| 25 | columns++; | 27 | columns++; |
| 26 | | 28 | |
| 27 | if (!base || !*base) | 29 | if (urls++ == 0) { |
| 28 | return; | 30 | htmlf("<tr class='nohover'><td colspan='%d'> </td></tr>", columns); |
| 29 | if (suffix && *suffix) { | 31 | htmlf("<tr><th class='left' colspan='%d'>Clone</th></tr>\n", columns); |
| 30 | strbuf_addf(&basebuf, "%s/%s", base, suffix); | | |
| 31 | base = basebuf.buf; | | |
| 32 | } | 32 | } |
| | 33 | |
| 33 | htmlf("<tr><td colspan='%d'><a href='", columns); | 34 | htmlf("<tr><td colspan='%d'><a href='", columns); |
| 34 | html_url_path(base); | 35 | html_url_path(url); |
| 35 | html("'>"); | 36 | html("'>"); |
| 36 | html_txt(base); | 37 | html_txt(url); |
| 37 | html("</a></td></tr>\n"); | 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 | void cgit_print_summary() | 41 | void cgit_print_summary() |
| @@ -88,10 +56,8 @@ void cgit_print_summary() · 14 unmodified lines |
| 88 | cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL, | 56 | cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL, |
| 89 | NULL, NULL, 0, 0, 0); | 57 | NULL, NULL, 0, 0, 0); |
| 90 | } | 58 | } |
| 91 | if (ctx.repo->clone_url) | 59 | urls = 0; |
| 92 | print_urls(expand_macros(ctx.repo->clone_url), NULL); | 60 | cgit_add_clone_urls(print_url); |
| 93 | else if (ctx.cfg.clone_prefix) | | |
| 94 | print_urls(ctx.cfg.clone_prefix, ctx.repo->url); | | |
| 95 | html("</table>"); | 61 | html("</table>"); |
| 96 | } | 62 | } |
| 97 | | 63 | |