From: Omar Polo Subject: gotwebd: support "owner" file To: gameoftrees@openbsd.org Date: Fri, 26 Jul 2024 11:51:41 +0200 This was requested some time ago on the IRC channel. The idea is to load another special file to fill the "owner" field of the repository. I've choosen to give the priority to the file rather than what's in the git config. ok? diffstat /home/op/w/got M gotwebd/got_operations.c | 0+ 5- M gotwebd/gotweb.c | 13+ 3- 2 files changed, 13 insertions(+), 8 deletions(-) diff /home/op/w/got commit - cbae186176b82efbf747a1486addb8b52c664651 path + /home/op/w/got blob - 697dd605540a5b24fafb364efc2c1a3926bd22c8 file + gotwebd/got_operations.c --- gotwebd/got_operations.c +++ gotwebd/got_operations.c @@ -101,16 +101,11 @@ got_gotweb_dupfd(int *priv_fd, int *fd) const struct got_error * got_get_repo_owner(char **owner, struct request *c) { - struct server *srv = c->srv; struct transport *t = c->t; struct got_repository *repo = t->repo; const char *gitconfig_owner; *owner = NULL; - - if (srv->show_repo_owner == 0) - return NULL; - gitconfig_owner = got_repo_get_gitconfig_owner(repo); if (gitconfig_owner) { *owner = strdup(gitconfig_owner); blob - a7cce8ea218018fc1805b2e77685728952ffc4c4 file + gotwebd/gotweb.c --- gotwebd/gotweb.c +++ gotwebd/gotweb.c @@ -88,6 +88,8 @@ static const struct got_error *gotweb_assign_querystri static int gotweb_render_index(struct template *); static const struct got_error *gotweb_load_got_path(struct repo_dir **, const char *, struct request *); +static const struct got_error *gotweb_load_file(char **, const char *, + const char *, int); static const struct got_error *gotweb_get_repo_description(char **, struct server *, const char *, int); static const struct got_error *gotweb_get_clone_url(char **, struct server *, @@ -1109,9 +1111,17 @@ gotweb_load_got_path(struct repo_dir **rp, const char repo_dir->path, dirfd(dt)); if (error) goto err; - error = got_get_repo_owner(&repo_dir->owner, c); - if (error) - goto err; + if (srv->show_repo_owner) { + error = gotweb_load_file(&repo_dir->owner, repo_dir->path, + "owner", dirfd(dt)); + if (error) + goto err; + if (repo_dir->owner == NULL) { + error = got_get_repo_owner(&repo_dir->owner, c); + if (error) + goto err; + } + } if (srv->show_repo_age) { error = got_get_repo_age(&repo_dir->age, c, NULL); if (error)