"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
gotwebd.conf: retire max_repos
To:
gameoftrees@openbsd.org
Date:
Fri, 29 Dec 2023 21:52:41 +0100

Download raw body.

Thread
I see little point in providing this knob.  Unlike max_repos_displays
which limits the number of repos per-page, max_repos is a hard limit on
the number of repositories gotwebd will process.

ok to remove?

diffstat -s /home/op/w/got
 M  gotwebd/gotweb.c        |  1+   8-
 M  gotwebd/gotwebd.conf.5  |  0+   5-
 M  gotwebd/gotwebd.h       |  0+   2-
 M  gotwebd/parse.y         |  1+  10-

4 files changed, 2 insertions(+), 25 deletions(-)

diff -s /home/op/w/got
commit - f497614d50d3ee9e26cb9ef89c5ec2fb8a13f676
path + /home/op/w/got (staged changes)
blob - cb7ff351528d07661dbabfbdb4d26756af7e252d
blob + 62d7787e1646b5e3c0bf02940f4da590182f7c29
--- gotwebd/gotweb.c
+++ gotwebd/gotweb.c
@@ -792,9 +792,6 @@ gotweb_render_index(struct template *tp)
 		return -1;
 
 	for (d_i = 0; d_i < t->nrepos; d_i++) {
-		if (srv->max_repos > 0 && t->prev_disp == srv->max_repos)
-			break;
-
 		if (strcmp(sd_dent[d_i]->d_name, ".") == 0 ||
 		    strcmp(sd_dent[d_i]->d_name, "..") == 0) {
 			d_skipped++;
@@ -848,11 +845,7 @@ gotweb_render_index(struct template *tp)
 	}
 	t->repos_total = t->nrepos - d_skipped;
 
-	if (srv->max_repos_display == 0)
-		return 0;
-	if (srv->max_repos > 0 && srv->max_repos < srv->max_repos_display)
-		return 0;
-	if (t->repos_total <= srv->max_repos ||
+	if (srv->max_repos_display == 0 ||
 	    t->repos_total <= srv->max_repos_display)
 		return 0;
 
blob - 97c8523a4a1c12d8bfa0da8c719c17fc93523304
blob + 2c4a828f3b8cde396a60854daae3bbc690ecdfd3
--- gotwebd/gotwebd.conf.5
+++ gotwebd/gotwebd.conf.5
@@ -123,11 +123,6 @@ Defaults to
 .It Ic max_commits_display Ar number
 Set the maximum amount of commits and tags displayed per page.
 Defaults to 25.
-.It Ic max_repos Ar number
-Set the maximum amount of repositories
-.Xr gotwebd 8
-will work with.
-Defaults to 0, showing all repositories.
 .It Ic max_repos_display Ar number
 Set the maximum amount of repositories displayed on the index screen.
 Defaults to 25.
blob - afa5bdf78876db639c2d76f70ed4ee8cd6e793c7
blob + 9adea01286908db58bde811ebffe397078853fe3
--- gotwebd/gotwebd.h
+++ gotwebd/gotwebd.h
@@ -75,7 +75,6 @@
 #define D_SHOWDESC		 1
 #define D_SHOWURL		 1
 #define D_RESPECTEXPORTOK	 0
-#define D_MAXREPO		 0
 #define D_MAXREPODISP		 25
 #define D_MAXSLCOMMDISP		 10
 #define D_MAXCOMMITDISP		 25
@@ -298,7 +297,6 @@ struct server {
 	char		 logo_url[GOTWEBD_MAXTEXT];
 	char		 custom_css[PATH_MAX];
 
-	size_t		 max_repos;
 	size_t		 max_repos_display;
 	size_t		 max_commits_display;
 	size_t		 summary_commits_display;
blob - 9848fc283aaafc5137c8cbdd288f9c58ca6793db
blob + f6bc017cf3e7e0a37f23b54c34c50085bf40ccc6
--- gotwebd/parse.y
+++ gotwebd/parse.y
@@ -108,7 +108,7 @@ typedef struct {
 
 %}
 
-%token	LISTEN WWW_PATH MAX_REPOS SITE_NAME SITE_OWNER SITE_LINK LOGO
+%token	LISTEN WWW_PATH SITE_NAME SITE_OWNER SITE_LINK LOGO
 %token	LOGO_URL SHOW_REPO_OWNER SHOW_REPO_AGE SHOW_REPO_DESCRIPTION
 %token	MAX_REPOS_DISPLAY REPOS_PATH MAX_COMMITS_DISPLAY ON ERROR
 %token	SHOW_SITE_OWNER SHOW_REPO_CLONEURL PORT PREFORK RESPECT_EXPORTOK
@@ -368,13 +368,6 @@ serveropts1	: REPOS_PATH STRING {
 			}
 			free($4);
 		}
-		| MAX_REPOS NUMBER {
-			if ($2 <= 0) {
-				yyerror("max_repos is too small: %lld", $2);
-				YYERROR;
-			}
-			new_srv->max_repos = $2;
-		}
 		| SHOW_SITE_OWNER boolean {
 			new_srv->show_site_owner = $2;
 		}
@@ -478,7 +471,6 @@ lookup(char *s)
 		{ "logo",			LOGO },
 		{ "logo_url",			LOGO_URL },
 		{ "max_commits_display",	MAX_COMMITS_DISPLAY },
-		{ "max_repos",			MAX_REPOS },
 		{ "max_repos_display",		MAX_REPOS_DISPLAY },
 		{ "on",				ON },
 		{ "port",			PORT },
@@ -930,7 +922,6 @@ conf_new_server(const char *name)
 	srv->max_commits_display = D_MAXCOMMITDISP;
 	srv->summary_commits_display = D_MAXSLCOMMDISP;
 	srv->summary_tags_display = D_MAXSLTAGDISP;
-	srv->max_repos = D_MAXREPO;
 
 	srv->unix_socket = 1;
 	srv->fcgi_socket = 0;