Diffstat (limited to 'cgit.c')
| -rw-r--r-- | cgit.c | 19 |
1 files changed, 7 insertions, 12 deletions
@@ -561,8 +561,12 @@ static void print_no_repo_clone_urls(const char *url) html("</a></td></tr>\n"); } -static void prepare_repo_env(int *nongit) +static int prepare_repo_cmd(void) { + struct object_id oid; + int nongit = 0; + int rc; + /* The path to the git repository. */ setenv("GIT_DIR", ctx.repo->path, 1); @@ -575,13 +579,8 @@ static void prepare_repo_env(int *nongit) /* Setup the git directory and initialize the notes system. Both of these * load local configuration from the git repository, so we do them both while * the HOME variables are unset. */ - setup_git_directory_gently(nongit); + setup_git_directory_gently(&nongit); init_display_notes(NULL); -} -static int prepare_repo_cmd(int nongit) -{ - struct object_id oid; - int rc; if (nongit) { const char *name = ctx.repo->name; @@ -701,7 +700,6 @@ static inline void authenticate_cookie(void) static void process_request(void) { struct cgit_cmd *cmd; - int nongit = 0; /* If we're not yet authenticated, no matter what page we're on, * display the authentication body from the auth_filter. This should @@ -717,9 +715,6 @@ static void process_request(void) return; } - if (ctx.repo) - prepare_repo_env(&nongit); - cmd = cgit_get_cmd(); if (!cmd) { ctx.page.title = "cgit error"; @@ -745,7 +740,7 @@ static void process_request(void) */ ctx.qry.vpath = cmd->want_vpath ? ctx.qry.path : NULL; - if (ctx.repo && prepare_repo_cmd(nongit)) + if (ctx.repo && prepare_repo_cmd()) return; cmd->fn(); |