From d1f3bbe9d22029f45a77bb938c176ccc0c827d46 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sat, 16 Feb 2008 13:56:09 +0100 Subject: Move cgit_repo into cgit_context This removes the global variable which is used to keep track of the currently selected repository, and adds a new variable in the cgit_context structure. Signed-off-by: Lars Hjemli --- ui-shared.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'ui-shared.c') diff --git a/ui-shared.c b/ui-shared.c index b96237d..b9f487a 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -141,8 +141,8 @@ static char *repolink(char *title, char *class, char *page, char *head, html_attr(ctx.cfg.virtual_root); if (ctx.cfg.virtual_root[strlen(ctx.cfg.virtual_root) - 1] != '/') html("/"); - html_attr(cgit_repo->url); - if (cgit_repo->url[strlen(cgit_repo->url) - 1] != '/') + html_attr(ctx.repo->url); + if (ctx.repo->url[strlen(ctx.repo->url) - 1] != '/') html("/"); if (page) { html(page); @@ -153,8 +153,8 @@ static char *repolink(char *title, char *class, char *page, char *head, } else { html(ctx.cfg.script_name); html("?url="); - html_attr(cgit_repo->url); - if (cgit_repo->url[strlen(cgit_repo->url) - 1] != '/') + html_attr(ctx.repo->url); + if (ctx.repo->url[strlen(ctx.repo->url) - 1] != '/') html("/"); if (page) { html(page); @@ -164,7 +164,7 @@ static char *repolink(char *title, char *class, char *page, char *head, } delim = "&"; } - if (head && strcmp(head, cgit_repo->defbranch)) { + if (head && strcmp(head, ctx.repo->defbranch)) { html(delim); html("h="); html_attr(head); @@ -446,7 +446,7 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page) html_hidden("url", url); } - if (incl_head && strcmp(ctx.qry.head, cgit_repo->defbranch)) + if (incl_head && strcmp(ctx.qry.head, ctx.repo->defbranch)) html_hidden("h", ctx.qry.head); if (ctx.qry.sha1) @@ -478,12 +478,12 @@ void cgit_print_pageheader(char *title, int show_search) html("\n\n"); if (ctx.qry.repo) { html("

"); - html_txt(strrpart(cgit_repo->name, 20)); + html_txt(strrpart(ctx.repo->name, 20)); html("

\n"); - html_txt(cgit_repo->desc); - if (cgit_repo->owner) { + html_txt(ctx.repo->desc); + if (ctx.repo->owner) { html("

owner

\n"); - html_txt(cgit_repo->owner); + html_txt(ctx.repo->owner); } html("

navigate

\n"); reporevlink(NULL, "summary", NULL, "menu", ctx.qry.head, @@ -501,13 +501,13 @@ void cgit_print_pageheader(char *title, int show_search) for_each_ref(print_archive_ref, &header); - if (cgit_repo->clone_url || ctx.cfg.clone_prefix) { + if (ctx.repo->clone_url || ctx.cfg.clone_prefix) { html("

clone

\n"); - if (cgit_repo->clone_url) - url = cgit_repo->clone_url; + if (ctx.repo->clone_url) + url = ctx.repo->clone_url; else url = fmt("%s%s", ctx.cfg.clone_prefix, - cgit_repo->url); + ctx.repo->url); html("