about summary refs log tree commit diff
path: root/shared.c
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2007-05-23 22:46:54 +0200
committerLars Hjemli <hjemli@gmail.com>2007-05-23 22:46:54 +0200
commitbbcdc290c6c0b8121e57dbca4bd66c9e5e729959 (patch)
treefb762f2153b60cc4f997095626af70baa16ce7b1 /shared.c
parentRemove unused variable from ui-repolist.c:read_agefile() (diff)
downloadcgit-pink-bbcdc290c6c0b8121e57dbca4bd66c9e5e729959.tar.gz
cgit-pink-bbcdc290c6c0b8121e57dbca4bd66c9e5e729959.zip
Add repo.readme parameter
This parameter can be used to specify a repo-specific includefile, which will
then be printed on the summary page for the repo.

If the parametervalue is a not an absolute path, it is taken to be relative
to repo.path.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to '')
-rw-r--r--shared.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/shared.c b/shared.c
index ce3ca4f..e3123a8 100644
--- a/shared.c
+++ b/shared.c
@@ -107,6 +107,7 @@ struct repoinfo *add_repo(const char *url)
 	ret->enable_log_filecount = cgit_enable_log_filecount;
 	ret->enable_log_linecount = cgit_enable_log_linecount;
 	ret->module_link = cgit_module_link;
+	ret->readme = NULL;
 	return ret;
 }
 
@@ -187,7 +188,12 @@ void cgit_global_config_cb(const char *name, const char *value)
 		cgit_repo->enable_log_linecount = cgit_enable_log_linecount * atoi(value);
 	else if (cgit_repo && !strcmp(name, "repo.module-link"))
 		cgit_repo->module_link= xstrdup(value);
-	else if (!strcmp(name, "include"))
+	else if (cgit_repo && !strcmp(name, "repo.readme") && value != NULL) {
+		if (*value == '/')
+			cgit_repo->readme = xstrdup(value);
+		else
+			cgit_repo->readme = xstrdup(fmt("%s/%s", cgit_repo->path, value));
+	} else if (!strcmp(name, "include"))
 		cgit_read_config(value, cgit_global_config_cb);
 }