Download raw body.
gotwebd: bubble up got_get_repo_tags
On 23-01-12 12:26PM, Omar Polo wrote: > This bubbles up the call to got_get_repo_tags from gotweb_render_tags > to its caller, gotweb_process_request and gotweb_render_summary. It > helps simplifying gotweb_render_summary and making it easier to > templateify, but also helps in untangling a bit the code. > > At this point gotweb_render_tags becomes just a wrapper to > gotweb_render_tags_tmpl so switch completely to it. > > It may help in revieving the diff remembering that > gotweb_render_summary calls gotweb_render_briefs before rendering the > tags, where qs->action is assigned to BRIEFS. > > ok? ok (notwithstanding the copypasta you noted in your follow-up) > diff /home/op/w/got > commit - 3ab2c91424750aef75f929402e6a7581a704f36d > path + /home/op/w/got > blob - df7d335b7261e2e7472a0004b490f669e3a56351 > file + gotwebd/gotweb.c > --- gotwebd/gotweb.c > +++ gotwebd/gotweb.c > @@ -95,7 +95,6 @@ static const struct got_error *gotweb_render_tags(stru > const char *, int); > static const struct got_error *gotweb_render_blame(struct request *); > static const struct got_error *gotweb_render_summary(struct request *); > -static const struct got_error *gotweb_render_tags(struct request *); > > static void gotweb_free_querystring(struct querystring *); > static void gotweb_free_repo_dir(struct repo_dir *); > @@ -310,11 +309,13 @@ render: > goto done; > break; > case TAGS: > - error = gotweb_render_tags(c); > + error = got_get_repo_tags(c, srv->max_commits_display); > if (error) { > log_warnx("%s: %s", __func__, error->msg); > - goto err; > + goto done; > } > + if (gotweb_render_tags(c->tp) == -1) > + goto done; > break; > case TREE: > error = got_get_repo_commits(c, 1); > @@ -1016,6 +1017,7 @@ gotweb_render_summary(struct request *c) > const struct got_error *error = NULL; > struct got_reflist_head refs; > struct transport *t = c->t; > + struct querystring *qs = t->qs; > struct got_repository *repo = t->repo; > struct server *srv = c->srv; > int r; > @@ -1073,41 +1075,20 @@ gotweb_render_summary(struct request *c) > if (gotweb_render_briefs(c->tp) == -1) > goto done; > > - error = gotweb_render_tags(c); > - if (error) { > - log_warnx("%s: %s", __func__, error->msg); > + qs->action = TAGS; > + error = got_get_repo_tags(c, D_MAXSLCOMMDISP); > + if (error) > goto done; > - } > > + if (gotweb_render_tags(c->tp) == -1) > + goto done; > + > gotweb_render_branches(c->tp, &refs); > done: > got_ref_list_free(&refs); > return error; > } > > -static const struct got_error * > -gotweb_render_tags(struct request *c) > -{ > - const struct got_error *error = NULL; > - struct server *srv = c->srv; > - struct transport *t = c->t; > - struct querystring *qs = t->qs; > - > - if (qs->action == BRIEFS) { > - qs->action = TAGS; > - error = got_get_repo_tags(c, D_MAXSLCOMMDISP); > - } else > - error = got_get_repo_tags(c, srv->max_commits_display); > - if (error) > - goto done; > - > - if (gotweb_render_tags_tmpl(c->tp) == -1) > - goto done; > - > -done: > - return error; > -} > - > const struct got_error * > gotweb_escape_html(char **escaped_html, const char *orig_html) > { > blob - 47eed11a0ded054e1f08fe6bee4bc4b5af4aea0e > file + gotwebd/gotwebd.h > --- gotwebd/gotwebd.h > +++ gotwebd/gotwebd.h > @@ -470,7 +470,7 @@ int gotweb_render_tags_tmpl(struct template *); > int gotweb_render_commits(struct template *); > int gotweb_render_blob(struct template *, struct got_blob_object *); > int gotweb_render_tree(struct template *); > -int gotweb_render_tags_tmpl(struct template *); > +int gotweb_render_tags(struct template *); > int gotweb_render_tag(struct template *); > int gotweb_render_diff(struct template *, FILE *); > int gotweb_render_branches(struct template *, struct got_reflist_head *); > blob - 6cf6d4d7e32e66e8dbd1cf8b8d9740fec9fe9ef2 > file + gotwebd/pages.tmpl > --- gotwebd/pages.tmpl > +++ gotwebd/pages.tmpl > @@ -577,7 +577,7 @@ gotweb_render_age(struct template *tp, time_t time, in > !} > {{ end }} > > -{{ define gotweb_render_tags_tmpl(struct template *tp) }} > +{{ define gotweb_render_tags(struct template *tp) }} > {! > struct request *c = tp->tp_arg; > struct transport *t = c->t; > -- Mark Jamsek <fnc.bsdbox.org> GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68
gotwebd: bubble up got_get_repo_tags