commit 417c89236426dd72eb3d8127de7747d4ac134f67 from: Omar Polo date: Fri Aug 11 10:26:50 2023 UTC gotwebd: fix branches modification time with show_repo_age off If show_repo_age is set to off, got_get_repo_age() returns without setting the timestamp. got_get_repo_age() is also used by the branch listing to show how old they are however, and we end up rendering the stack garbage. Instead, respect `show_repo_age off' one layer above, and always return a timestamp in got_get_repo_age(). While here, initialize the timestamp to zero so it's set also in case of failures. Issue reported on IRC by xs, thanks! commit - 2e76d8a7c48df35fbab843656f1c604c999ed71f commit + 417c89236426dd72eb3d8127de7747d4ac134f67 blob - a7525287e2c962f40938fd909cdb0b9142d1f605 blob + 6d9d5cf8b5507c4d545eca925df5fe128789c73a --- gotwebd/got_operations.c +++ gotwebd/got_operations.c @@ -128,7 +128,6 @@ const struct got_error * got_get_repo_age(time_t *repo_age, struct request *c, const char *refname) { const struct got_error *error = NULL; - struct server *srv = c->srv; struct transport *t = c->t; struct got_repository *repo = t->repo; struct got_commit_object *commit = NULL; @@ -138,8 +137,7 @@ got_get_repo_age(time_t *repo_age, struct request *c, TAILQ_INIT(&refs); - if (srv->show_repo_age == 0) - return NULL; + *repo_age = 0; error = got_ref_list(&refs, repo, "refs/heads", got_ref_cmp_by_name, NULL); blob - f481972feb3305dfe470ae86b2a645949baf4045 blob + d9c0aa2de83b12df70d1fbce28bfddc549348a9c --- gotwebd/gotweb.c +++ gotwebd/gotweb.c @@ -1219,11 +1219,13 @@ done: if (error) goto err; error = got_get_repo_owner(&repo_dir->owner, c); - if (error) - goto err; - error = got_get_repo_age(&repo_dir->age, c, NULL); if (error) goto err; + if (srv->show_repo_age) { + error = got_get_repo_age(&repo_dir->age, c, NULL); + if (error) + goto err; + } error = gotweb_get_clone_url(&repo_dir->url, srv, repo_dir->path, dirfd(dt)); err: