display 'No repositories found in $got_repos_path" if gotweb finds no repos
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/gotweb/gotweb.c b/gotweb/gotweb.c
index 8428efb..feeaec0 100644
--- a/gotweb/gotweb.c
+++ b/gotweb/gotweb.c
@@ -391,6 +391,15 @@ gw_index(struct gw_trans *gw_trans)
khttp_puts(gw_trans->gw_req, index_projects_header);
+ if (TAILQ_EMPTY(&gw_trans->gw_dirs)) {
+ if (asprintf(&html, index_projects_empty,
+ gw_trans->gw_conf->got_repos_path) == -1)
+ return got_error_from_errno("asprintf");
+ khttp_puts(gw_trans->gw_req, html);
+ free(html);
+ return NULL;
+ }
+
TAILQ_FOREACH(gw_dir, &gw_trans->gw_dirs, entry)
dir_c++;
diff --git a/gotweb/gotweb_ui.h b/gotweb/gotweb_ui.h
index ba8f6bf..a34224a 100644
--- a/gotweb/gotweb_ui.h
+++ b/gotweb/gotweb_ui.h
@@ -290,6 +290,12 @@ char *index_projects =
"</div>" \
"<div id='dotted_line'></div>";
+char *index_projects_empty =
+ "<div id='index_wrapper'>" \
+ "No repositories found in %s" \
+ "</div>" \
+ "<div id='dotted_line'></div>";
+
char *index_navs =
"<a href='?path=%s&action=summary'>summary</a> | " \
"<a href='?path=%s&action=briefs'>commit briefs</a> | " \