commit - b3ba36c380dd6686b46f27d33ed4e8ee67d7426d
commit + 18e466eb6a2dc223f99d645f35ebf2f2f44a9f77
blob - b0990fa5496b65df45995ab15153323795171ee9
blob + 89835b809483926295d4f94fdd520e86acc5b32e
--- gotwebd/gotweb.c
+++ gotwebd/gotweb.c
static const struct got_error *gotweb_get_clone_url(char **, struct server *,
const char *, int);
static const struct got_error *gotweb_render_blame(struct request *);
-static const struct got_error *gotweb_render_summary(struct request *);
static void gotweb_free_querystring(struct querystring *);
static void gotweb_free_repo_dir(struct repo_dir *);
struct server *srv = NULL;
struct querystring *qs = NULL;
struct repo_dir *repo_dir = NULL;
+ struct got_reflist_head refs;
FILE *fp = NULL;
uint8_t err[] = "gotwebd experienced an error: ";
int r, html = 0, fd = -1;
+
+ TAILQ_INIT(&refs);
/* init the transport */
error = gotweb_init_transport(&c->t);
}
break;
case SUMMARY:
- error = gotweb_render_summary(c);
+ error = got_ref_list(&refs, c->t->repo, "refs/heads",
+ got_ref_cmp_by_name, NULL);
if (error) {
- log_warnx("%s: %s", __func__, error->msg);
+ log_warnx("%s: got_ref_list: %s", __func__,
+ error->msg);
goto err;
}
+ qs->action = TAGS;
+ error = got_get_repo_tags(c, D_MAXSLCOMMDISP);
+ if (error) {
+ log_warnx("%s: got_get_repo_tags: %s", __func__,
+ error->msg);
+ goto err;
+ }
+ qs->action = SUMMARY;
+ if (gotweb_render_summary(c->tp, &refs) == -1)
+ goto done;
break;
case TAG:
error = got_get_repo_tags(c, 1);
close(fd);
if (html && srv != NULL)
gotweb_render_footer(c->tp);
+
+ got_ref_list_free(&refs);
}
struct server *
done:
free(age);
free(msg);
- return error;
-}
-
-static const struct got_error *
-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;
-
- TAILQ_INIT(&refs);
-
- error = got_ref_list(&refs, repo, "refs/heads",
- got_ref_cmp_by_name, NULL);
- if (error)
- goto done;
-
- if (fcgi_printf(c, "<div id='summary_wrapper'>\n") == -1)
- goto done;
-
- if (srv->show_repo_description) {
- r = fcgi_printf(c,
- "<div id='description_title'>Description:</div>\n"
- "<div id='description'>%s</div>\n",
- t->repo_dir->description ? t->repo_dir->description : "");
- if (r == -1)
- goto done;
- }
-
- if (srv->show_repo_owner) {
- r = fcgi_printf(c,
- "<div id='repo_owner_title'>Owner:</div>\n"
- "<div id='repo_owner'>%s</div>\n",
- t->repo_dir->owner ? t->repo_dir->owner : "");
- if (r == -1)
- goto done;
- }
-
- if (srv->show_repo_age) {
- r = fcgi_printf(c,
- "<div id='last_change_title'>Last Change:</div>\n"
- "<div id='last_change'>%s</div>\n",
- t->repo_dir->age);
- if (r == -1)
- goto done;
- }
-
- if (srv->show_repo_cloneurl) {
- r = fcgi_printf(c,
- "<div id='cloneurl_title'>Clone URL:</div>\n"
- "<div id='cloneurl'>%s</div>\n",
- t->repo_dir->url ? t->repo_dir->url : "");
- if (r == -1)
- goto done;
- }
-
- r = fcgi_printf(c, "</div>\n"); /* #summary_wrapper */
- if (r == -1)
- goto done;
-
- if (gotweb_render_briefs(c->tp) == -1)
- goto done;
-
- 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;
}
blob - c625c27f2bee1409fe6562219936a8d0e9948a55
blob + 94bb71fb582793f9bab63b019ba12be89ea61ef1
--- gotwebd/gotwebd.h
+++ gotwebd/gotwebd.h
int gotweb_render_tag(struct template *);
int gotweb_render_diff(struct template *, FILE *);
int gotweb_render_branches(struct template *, struct got_reflist_head *);
+int gotweb_render_summary(struct template *, struct got_reflist_head *);
int gotweb_render_rss(struct template *);
/* parse.y */
blob - 086325e9d628e2ff56488783ccdc6d871efc5089
blob + dc3656edae244fbc586f81ad359f6b9ca8c8085d
--- gotwebd/pages.tmpl
+++ gotwebd/pages.tmpl
</div>
{{ finally }}
{! free(age); !}
+{{ end }}
+
+{{ define gotweb_render_summary(struct template *tp,
+ struct got_reflist_head *refs) }}
+{!
+ struct request *c = tp->tp_arg;
+ struct server *srv = c->srv;
+ struct transport *t = c->t;
+!}
+<div id="summary_wrapper">
+ {{ if srv->show_repo_description }}
+ <div id="description_title">Description:</div>
+ <div id="description">{{ t->repo_dir->description }}</div>
+ {{ end }}
+ {{ if srv->show_repo_owner }}
+ <div id="repo_owner_title">Owner:</div>
+ <div id="repo_owner">{{ t->repo_dir->owner }}</div>
+ {{ end }}
+ {{ if srv->show_repo_age }}
+ <div id="last_change_title">Last Change:</div>
+ <div id="last_change">{{ t->repo_dir->age }}</div>
+ {{ end }}
+ {{ if srv->show_repo_cloneurl }}
+ <div id="cloneurl_title">Clone URL:</div>
+ <div id="cloneurl">{{ t->repo_dir->url }}</div>
+ {{ end }}
+</div>
+{{ render gotweb_render_briefs(tp) }}
+{{ render gotweb_render_tags(tp) }}
+{{ render gotweb_render_branches(tp, refs) }}
{{ end }}
{{ define gotweb_render_rss(struct template *tp) }}