From: Stefan Sperling Subject: repository description in gotwebd.conf To: gameoftrees@openbsd.org Date: Sat, 10 Jan 2026 18:00:25 +0100 I would like to allow setting repository descriptions in gotwebd.conf. Use of this feature is optional and the behaviour remains unchanged if the feature is not used. Having this feature will make it easier to support setting repository descriptions for gotwebd via gotsysd. Write descriptions directly to gotwebd.conf avoids having to overwrite every repository's description file on disk. ok? make it possible to set repository decriptions in gotwebd.conf M gotwebd/gotweb.c | 12+ 4- M gotwebd/gotwebd.conf.5 | 17+ 1- M gotwebd/gotwebd.h | 1+ 0- M gotwebd/parse.y | 13+ 1- 4 files changed, 43 insertions(+), 6 deletions(-) commit - 9c96eb388d26057a3365cb1d2c3e140d73a638ab commit + 1a889bdb535e639ab1624aff3cf1880464e652f5 blob - 4f10d5b34758e3295506e6968f6484005cde9612 blob + ffee229a7d6177f753c8d9b67ba1aaad017e08d1 --- gotwebd/gotweb.c +++ gotwebd/gotweb.c @@ -1671,10 +1671,18 @@ gotweb_load_got_path(struct repo_dir **rp, const char gotwebd_env->pack_fds); if (error) goto err; - error = gotweb_get_repo_description(&repo_dir->description, srv, - repo_dir->path, dirfd(dt)); - if (error) - goto err; + if (repo && repo->description[0] != '\0') { + repo_dir->description = strdup(repo->description); + if (repo_dir->description == NULL) { + error = got_error_from_errno("strdup"); + goto err; + } + } else { + error = gotweb_get_repo_description(&repo_dir->description, + srv, repo_dir->path, dirfd(dt)); + if (error) + goto err; + } if (srv->show_repo_owner) { error = gotweb_load_file(&repo_dir->owner, repo_dir->path, "owner", dirfd(dt)); blob - 5707f5abffcada5369e98d6a90bab60320b6f6b2 blob + 1ff703a318a3f2deb6dc91432b401dc5a9666300 --- gotwebd/gotwebd.conf.5 +++ gotwebd/gotwebd.conf.5 @@ -470,6 +470,18 @@ is enabled. .Pp The available repository configuration directives are as follows: .Bl -tag -width Ds +.It Ic description Ar string +Sets the repository description shown on the repository listing page. +The +.Ar string +parameter should be wrapped in quotes and can only contain one line of text. +.Pp +If no description is set in +.Nm +then the description stored in the repository's +.Pa description +file will be shown instead. +This file may contain multiple lines of text. .It Ic deny Ar identity Deny repository access to users with the username .Ar identity . @@ -626,7 +638,11 @@ Toggle display of the repository description. Enabled by default. The .Pa description -file in the repository should be updated with an appropriate description. +file in the repository should be updated with an appropriate description, +Alternatively, the per-repository +.Ic description +option can be used to set a description in +.Nm . .It Ic show_repo_owner Ar on | off Set whether to display the repository owner. Enabled by default. blob - 13d030bc095cf095c657d696ae716f9fa1dbc782 blob + d33a473211f9b6d1f97dac15ca9b453a9ec4035b --- gotwebd/gotwebd.h +++ gotwebd/gotwebd.h @@ -387,6 +387,7 @@ struct gotwebd_repo { TAILQ_ENTRY(gotwebd_repo) entry; char name[NAME_MAX]; + char description[GOTWEBD_MAXDESCRSZ]; enum gotwebd_auth_config auth_config; struct gotwebd_access_rule_list access_rules; blob - 57beb717a572f78e1e1ac9452a9bcfd38e2bf1cd blob + d7ad16d93f68bb3f742baac27bc72c4373600b62 --- gotwebd/parse.y +++ gotwebd/parse.y @@ -155,7 +155,7 @@ mediatype_ok(const char *s) %token SERVER CHROOT CUSTOM_CSS SOCKET HINT HTDOCS GOTWEB_URL_ROOT %token SUMMARY_COMMITS_DISPLAY SUMMARY_TAGS_DISPLAY USER AUTHENTICATION %token ENABLE DISABLE INSECURE REPOSITORY REPOSITORIES PERMIT DENY HIDE -%token WEBSITE PATH BRANCH REPOS_URL_PATH +%token WEBSITE PATH BRANCH REPOS_URL_PATH DESCRIPTION %token TYPES INCLUDE %token STRING @@ -942,6 +942,17 @@ repoopts1 : DISABLE AUTHENTICATION { | HIDE REPOSITORY boolean { new_repo->hidden = $3; } + | DESCRIPTION STRING { + n = strlcpy(new_repo->description, $2, + sizeof(new_repo->description)); + if (n >= sizeof(new_repo->description)) { + yyerror("repository description too long, " + "exceeds %zd bytes", + sizeof(new_repo->description) - 1); + free($2); + YYERROR; + } + } ; types : TYPES '{' optnl mediaopts_l '}' @@ -1056,6 +1067,7 @@ lookup(char *s) { "chroot", CHROOT }, { "custom_css", CUSTOM_CSS }, { "deny", DENY }, + { "description", DESCRIPTION }, { "disable", DISABLE }, { "enable", ENABLE }, { "gotweb_url_root", GOTWEB_URL_ROOT },