History

cgit: show clone URLs for empty repo

Jason A. Donenfeld committed 11 years ago

Commit bd248321 parent db9a70b2 files · +17 −1Browse files

Unified · Split

2 files
  1. cgit.c +16 −0
  2. ui-summary.c +1 −1
cgit.c+16−0
@@ -536,6 +536,17 @@ static void choose_readme(struct cgit_repo *repo) · 535 unmodified lines
536536 string_list_append(&repo->readme, filename)->util = ref;
537537 }
538538
539+static void print_no_repo_clone_urls(const char *url)
540+{
541+ html("<tr><td><a rel='vcs-git' href='");
542+ html_url_path(url);
543+ html("' title='");
544+ html_attr(ctx.repo->name);
545+ html(" Git repository'>");
546+ html_txt(url);
547+ html("</a></td></tr>\n");
548+}
549+
539550 static int prepare_repo_cmd(void)
540551 {
541552 unsigned char sha1[20];
@@ -586,6 +597,11 @@ static int prepare_repo_cmd(void) · 44 unmodified lines
586597 cgit_print_docstart();
587598 cgit_print_pageheader();
588599 cgit_print_error("Repository seems to be empty");
600+ if (!strcmp(ctx.qry.page, "summary")) {
601+ html("<table class='list'><tr class='nohover'><td>&nbsp;</td></tr><tr class='nohover'><th class='left'>Clone</th></tr>\n");
602+ cgit_add_clone_urls(print_no_repo_clone_urls);
603+ html("</table>\n");
604+ }
589605 cgit_print_docend();
590606 return 1;
591607 }
ui-summary.c+1−1
@@ -28,7 +28,7 @@ static void print_url(const char *url) · 27 unmodified lines
2828
2929 if (urls++ == 0) {
3030 htmlf("<tr class='nohover'><td colspan='%d'>&nbsp;</td></tr>", columns);
31− htmlf("<tr><th class='left' colspan='%d'>Clone</th></tr>\n", columns);
31+ htmlf("<tr class='nohover'><th class='left' colspan='%d'>Clone</th></tr>\n", columns);
3232 }
3333
3434 htmlf("<tr><td colspan='%d'><a rel='vcs-git' href='", columns);