aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui-repolist.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/ui-repolist.c b/ui-repolist.c
index 4912fa5..6010a39 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -115,6 +115,17 @@ static int is_visible(struct cgit_repo *repo)
115 return 1; 115 return 1;
116} 116}
117 117
118static int any_repos_visible(void)
119{
120 int i;
121
122 for (i = 0; i < cgit_repolist.count; i++) {
123 if (is_visible(&cgit_repolist.repos[i]))
124 return 1;
125 }
126 return 0;
127}
128
118static void print_sort_header(const char *title, const char *sort) 129static void print_sort_header(const char *title, const char *sort)
119{ 130{
120 char *currenturl = cgit_currenturl(); 131 char *currenturl = cgit_currenturl();
@@ -266,6 +277,11 @@ void cgit_print_repolist(void)
266 char *section; 277 char *section;
267 int sorted = 0; 278 int sorted = 0;
268 279
280 if (!any_repos_visible()) {
281 cgit_print_error_page(404, "Not found", "No repositories found");
282 return;
283 }
284
269 if (ctx.cfg.enable_index_links) 285 if (ctx.cfg.enable_index_links)
270 ++columns; 286 ++columns;
271 if (ctx.cfg.enable_index_owner) 287 if (ctx.cfg.enable_index_owner)
@@ -347,9 +363,7 @@ void cgit_print_repolist(void)
347 html("</tr>\n"); 363 html("</tr>\n");
348 } 364 }
349 html("</table>"); 365 html("</table>");
350 if (!hits) 366 if (hits > ctx.cfg.max_repo_count)
351 cgit_print_error("No repositories found");
352 else if (hits > ctx.cfg.max_repo_count)
353 print_pager(hits, ctx.cfg.max_repo_count, ctx.qry.search, ctx.qry.sort); 367 print_pager(hits, ctx.cfg.max_repo_count, ctx.qry.search, ctx.qry.sort);
354 cgit_print_docend(); 368 cgit_print_docend();
355} 369}