summaryrefslogtreecommitdiffabout
path: root/cgit.c
Side-by-side diff
Diffstat (limited to 'cgit.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/cgit.c b/cgit.c
index f0907a1..b270fdc 100644
--- a/cgit.c
+++ b/cgit.c
@@ -12,3 +12,3 @@ static int cgit_prepare_cache(struct cacheitem *item)
{
- if (!cgit_repo && ctx.qry.repo) {
+ if (!ctx.repo && ctx.qry.repo) {
char *title = fmt("%s - %s", ctx.cfg.root_title, "Bad request");
@@ -21,3 +21,3 @@ static int cgit_prepare_cache(struct cacheitem *item)
- if (!cgit_repo) {
+ if (!ctx.repo) {
item->name = xstrdup(fmt("%s/index.html", ctx.cfg.cache_root));
@@ -29,3 +29,3 @@ static int cgit_prepare_cache(struct cacheitem *item)
item->name = xstrdup(fmt("%s/%s/index.%s.html", ctx.cfg.cache_root,
- cache_safe_filename(cgit_repo->url),
+ cache_safe_filename(ctx.repo->url),
cache_safe_filename(ctx.qry.raw)));
@@ -34,3 +34,3 @@ static int cgit_prepare_cache(struct cacheitem *item)
item->name = xstrdup(fmt("%s/%s/%s/%s.html", ctx.cfg.cache_root,
- cache_safe_filename(cgit_repo->url),
+ cache_safe_filename(ctx.repo->url),
ctx.qry.page,
@@ -66,3 +66,3 @@ int find_current_ref(const char *refname, const unsigned char *sha1,
-char *find_default_branch(struct repoinfo *repo)
+char *find_default_branch(struct cgit_repo *repo)
{
@@ -86,3 +86,3 @@ static void cgit_print_repo_page(struct cacheitem *item)
- if (chdir(cgit_repo->path)) {
+ if (chdir(ctx.repo->path)) {
title = fmt("%s - %s", ctx.cfg.root_title, "Bad request");
@@ -96,9 +96,9 @@ static void cgit_print_repo_page(struct cacheitem *item)
- title = fmt("%s - %s", cgit_repo->name, cgit_repo->desc);
+ title = fmt("%s - %s", ctx.repo->name, ctx.repo->desc);
show_search = 0;
- setenv("GIT_DIR", cgit_repo->path, 1);
+ setenv("GIT_DIR", ctx.repo->path, 1);
if (!ctx.qry.head) {
- ctx.qry.head = xstrdup(find_default_branch(cgit_repo));
- cgit_repo->defbranch = ctx.qry.head;
+ ctx.qry.head = xstrdup(find_default_branch(ctx.repo));
+ ctx.repo->defbranch = ctx.qry.head;
}
@@ -115,3 +115,3 @@ static void cgit_print_repo_page(struct cacheitem *item)
tmp = xstrdup(ctx.qry.head);
- ctx.qry.head = cgit_repo->defbranch;
+ ctx.qry.head = ctx.repo->defbranch;
cgit_print_docstart(title, item);
@@ -123,7 +123,7 @@ static void cgit_print_repo_page(struct cacheitem *item)
- if ((cgit_cmd == CMD_SNAPSHOT) && cgit_repo->snapshots) {
+ if ((cgit_cmd == CMD_SNAPSHOT) && ctx.repo->snapshots) {
cgit_print_snapshot(item, ctx.qry.head, ctx.qry.sha1,
- cgit_repobasename(cgit_repo->url),
+ cgit_repobasename(ctx.repo->url),
ctx.qry.path,
- cgit_repo->snapshots );
+ ctx.repo->snapshots );
return;
@@ -194,3 +194,3 @@ static void cgit_fill_cache(struct cacheitem *item, int use_cache)
- if (cgit_repo)
+ if (ctx.repo)
cgit_print_repo_page(item);
@@ -302,3 +302,2 @@ int main(int argc, const char **argv)
cgit_global_config_cb);
- cgit_repo = NULL;
if (getenv("SCRIPT_NAME"))