From 2e4a41e84029cbfa70c654fe5dfb35747f2dfbba Mon Sep 17 00:00:00 2001 From: Jason A. Donenfeld Date: Tue, 3 Mar 2015 17:23:40 +0100 Subject: Make root handling sane again. --- ui-shared.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'ui-shared.c') diff --git a/ui-shared.c b/ui-shared.c index 838437c..ff03cb2 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -147,14 +147,14 @@ const char *cgit_repobasename(const char *reponame) return rvbuf; } -static void site_url(const char *page, const char *search, const char *sort, int ofs) +static void site_url(const char *page, const char *search, const char *sort, int ofs, int always_root) { char *delim = "?"; - if (!page) - html_attr(cgit_currenturl()); - else + if (always_root || page) html_attr(cgit_rooturl()); + else + html_attr(cgit_currenturl()); if (page) { htmlf("?p=%s", page); @@ -179,7 +179,7 @@ static void site_url(const char *page, const char *search, const char *sort, int } static void site_link(const char *page, const char *name, const char *title, - const char *class, const char *search, const char *sort, int ofs) + const char *class, const char *search, const char *sort, int ofs, int always_root) { html(""); html_txt(name); html(""); } void cgit_index_link(const char *name, const char *title, const char *class, - const char *pattern, const char *sort, int ofs) + const char *pattern, const char *sort, int ofs, int always_root) { - site_link(NULL, name, title, class, pattern, sort, ofs); + site_link(NULL, name, title, class, pattern, sort, ofs, always_root); } static char *repolink(const char *title, const char *class, const char *page, @@ -446,7 +446,7 @@ static void cgit_self_link(char *name, const char *title, const char *class) { if (!strcmp(ctx.qry.page, "repolist")) cgit_index_link(name, title, class, ctx.qry.search, ctx.qry.sort, - ctx.qry.ofs); + ctx.qry.ofs, 1); else if (!strcmp(ctx.qry.page, "summary")) cgit_summary_link(name, title, class, ctx.qry.head); else if (!strcmp(ctx.qry.page, "tag")) @@ -875,7 +875,7 @@ static void print_header(void) html("