about summary refs log tree commit diff
path: root/cgit.c
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2008-04-29 01:13:08 +0200
committerLars Hjemli <hjemli@gmail.com>2008-04-29 01:13:08 +0200
commit905dbaef5aa33ea11d385b82de0188fee73dd655 (patch)
tree34712da2eef917be04b2acc5585612b65c1e49cc /cgit.c
parentui-diff: remove test on object type (diff)
parentAdd 'about site' and 'about repo' pages (diff)
downloadcgit-pink-905dbaef5aa33ea11d385b82de0188fee73dd655.tar.gz
cgit-pink-905dbaef5aa33ea11d385b82de0188fee73dd655.zip
Merge branch 'lh/about'
* lh/about:
  Add 'about site' and 'about repo' pages
  Prepare for 'about site' page / add 'root-readme' option to cgitrc
  Make it possible for a single cmd to work both with and without a repo
  Re-enable 'index-info' and add support for 'root-desc' in cgitrc
  Move included header-file out of repolist table
  Prepare for 'about repo' page
Diffstat (limited to '')
-rw-r--r--cgit.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/cgit.c b/cgit.c
index 38b0ba5..a402758 100644
--- a/cgit.c
+++ b/cgit.c
@@ -19,6 +19,10 @@ void config_cb(const char *name, const char *value)
 {
 	if (!strcmp(name, "root-title"))
 		ctx.cfg.root_title = xstrdup(value);
+	else if (!strcmp(name, "root-desc"))
+		ctx.cfg.root_desc = xstrdup(value);
+	else if (!strcmp(name, "root-readme"))
+		ctx.cfg.root_readme = xstrdup(value);
 	else if (!strcmp(name, "css"))
 		ctx.cfg.css = xstrdup(value);
 	else if (!strcmp(name, "logo"))
@@ -159,6 +163,7 @@ static void prepare_context(struct cgit_context *ctx)
 	ctx->cfg.renamelimit = -1;
 	ctx->cfg.robots = "index, nofollow";
 	ctx->cfg.root_title = "Git repository browser";
+	ctx->cfg.root_desc = "a fast webinterface for the git dscm";
 	ctx->cfg.script_name = CGIT_SCRIPT_NAME;
 	ctx->page.mimetype = "text/html";
 	ctx->page.charset = PAGE_ENCODING;
@@ -304,7 +309,16 @@ static void process_request(struct cgit_context *ctx)
 		return;
 	}
 
-	if (cmd->want_repo && prepare_repo_cmd(ctx))
+	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) {