summaryrefslogtreecommitdiffabout
path: root/cgit.c
authorLars Hjemli <hjemli@gmail.com>2009-01-11 21:00:25 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2009-01-11 21:00:25 (UTC)
commit31665579c2779669c0cc56b8eb63f162b7e165df (patch) (side-by-side diff)
treeb1d7ed4cd04699d3f978950e09c1218944926175 /cgit.c
parent372b4041bd117cf073082559e1f0160d75f57374 (diff)
parenteb14609dc46461728a065c0a243b338fc32fd762 (diff)
downloadcgit-31665579c2779669c0cc56b8eb63f162b7e165df.zip
cgit-31665579c2779669c0cc56b8eb63f162b7e165df.tar.gz
cgit-31665579c2779669c0cc56b8eb63f162b7e165df.tar.bz2
Merge branch 'stable'
Diffstat (limited to 'cgit.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/cgit.c b/cgit.c
index d1cee58..f35f605 100644
--- a/cgit.c
+++ b/cgit.c
@@ -248,97 +248,96 @@ static int prepare_repo_cmd(struct cgit_context *ctx)
"config error");
tmp = fmt("Not a git repository: '%s'", ctx->repo->path);
ctx->repo = NULL;
cgit_print_http_headers(ctx);
cgit_print_docstart(ctx);
cgit_print_pageheader(ctx);
cgit_print_error(tmp);
cgit_print_docend();
return 1;
}
ctx->page.title = fmt("%s - %s", ctx->repo->name, ctx->repo->desc);
if (!ctx->qry.head) {
ctx->qry.nohead = 1;
ctx->qry.head = find_default_branch(ctx->repo);
ctx->repo->defbranch = ctx->qry.head;
}
if (!ctx->qry.head) {
cgit_print_http_headers(ctx);
cgit_print_docstart(ctx);
cgit_print_pageheader(ctx);
cgit_print_error("Repository seems to be empty");
cgit_print_docend();
return 1;
}
if (get_sha1(ctx->qry.head, sha1)) {
tmp = xstrdup(ctx->qry.head);
ctx->qry.head = ctx->repo->defbranch;
cgit_print_http_headers(ctx);
cgit_print_docstart(ctx);
cgit_print_pageheader(ctx);
cgit_print_error(fmt("Invalid branch: %s", tmp));
cgit_print_docend();
return 1;
}
return 0;
}
static void process_request(void *cbdata)
{
struct cgit_context *ctx = cbdata;
struct cgit_cmd *cmd;
cmd = cgit_get_cmd(ctx);
if (!cmd) {
ctx->page.title = "cgit error";
- ctx->repo = NULL;
cgit_print_http_headers(ctx);
cgit_print_docstart(ctx);
cgit_print_pageheader(ctx);
cgit_print_error("Invalid request");
cgit_print_docend();
return;
}
if (cmd->want_repo && !ctx->repo) {
cgit_print_http_headers(ctx);
cgit_print_docstart(ctx);
cgit_print_pageheader(ctx);
cgit_print_error(fmt("No repository selected"));
cgit_print_docend();
return;
}
if (ctx->repo && prepare_repo_cmd(ctx))
return;
if (cmd->want_layout) {
cgit_print_http_headers(ctx);
cgit_print_docstart(ctx);
cgit_print_pageheader(ctx);
}
cmd->fn(ctx);
if (cmd->want_layout)
cgit_print_docend();
}
int cmp_repos(const void *a, const void *b)
{
const struct cgit_repo *ra = a, *rb = b;
return strcmp(ra->url, rb->url);
}
void print_repo(struct cgit_repo *repo)
{
printf("repo.url=%s\n", repo->url);
printf("repo.name=%s\n", repo->name);
printf("repo.path=%s\n", repo->path);
if (repo->owner)
printf("repo.owner=%s\n", repo->owner);
if (repo->desc)
printf("repo.desc=%s\n", repo->desc);
if (repo->readme)