cgit: show clone URLs for empty repo

This commit is contained in:
Jason A. Donenfeld 2015-03-05 02:18:42 +01:00
والد db9a70b159
کامیت bd24832cd7
2فایلهای تغییر یافته به همراه17 افزوده شده و 1 حذف شده

16
cgit.c
مشاهده پرونده

@ -536,6 +536,17 @@ static void choose_readme(struct cgit_repo *repo)
string_list_append(&repo->readme, filename)->util = ref; string_list_append(&repo->readme, filename)->util = ref;
} }
static void print_no_repo_clone_urls(const char *url)
{
html("<tr><td><a rel='vcs-git' href='");
html_url_path(url);
html("' title='");
html_attr(ctx.repo->name);
html(" Git repository'>");
html_txt(url);
html("</a></td></tr>\n");
}
static int prepare_repo_cmd(void) static int prepare_repo_cmd(void)
{ {
unsigned char sha1[20]; unsigned char sha1[20];
@ -586,6 +597,11 @@ static int prepare_repo_cmd(void)
cgit_print_docstart(); cgit_print_docstart();
cgit_print_pageheader(); cgit_print_pageheader();
cgit_print_error("Repository seems to be empty"); cgit_print_error("Repository seems to be empty");
if (!strcmp(ctx.qry.page, "summary")) {
html("<table class='list'><tr class='nohover'><td>&nbsp;</td></tr><tr class='nohover'><th class='left'>Clone</th></tr>\n");
cgit_add_clone_urls(print_no_repo_clone_urls);
html("</table>\n");
}
cgit_print_docend(); cgit_print_docend();
return 1; return 1;
} }

مشاهده پرونده

@ -28,7 +28,7 @@ static void print_url(const char *url)
if (urls++ == 0) { if (urls++ == 0) {
htmlf("<tr class='nohover'><td colspan='%d'>&nbsp;</td></tr>", columns); htmlf("<tr class='nohover'><td colspan='%d'>&nbsp;</td></tr>", columns);
htmlf("<tr><th class='left' colspan='%d'>Clone</th></tr>\n", columns); htmlf("<tr class='nohover'><th class='left' colspan='%d'>Clone</th></tr>\n", columns);
} }
htmlf("<tr><td colspan='%d'><a rel='vcs-git' href='", columns); htmlf("<tr><td colspan='%d'><a rel='vcs-git' href='", columns);