cgit

commit bd24832cd7a72117afb7fa785f4e6bfa4324bf30

Author: Jason A. Donenfeld <Jason@zx2c4.com>

cgit: show clone URLs for empty repo

 cgit.c | 16 ++++++++++++++++
 ui-summary.c | 2 +-


diff --git a/cgit.c b/cgit.c
index 02ddddaa2bf669b3d65dd4f5570a013a8f1a7dd7..0ad81716f17b3b5bf903e497aaaa4131134ed96a 100644
--- a/cgit.c
+++ b/cgit.c
@@ -536,6 +536,17 @@ 	if (found)
 		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)
 {
 	unsigned char sha1[20];
@@ -586,6 +597,11 @@ 		cgit_print_http_headers();
 		cgit_print_docstart();
 		cgit_print_pageheader();
 		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();
 		return 1;
 	}




diff --git a/ui-summary.c b/ui-summary.c
index 46ca71349f8649369500a4f7e3304959acc674ab..fa5ba0423669bb9a00ee8fa3dcebb274c7e7076a 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -28,7 +28,7 @@ 		columns++;
 
 	if (urls++ == 0) {
 		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);