summaryrefslogtreecommitdiffabout
path: root/shared.c
Side-by-side diff
Diffstat (limited to 'shared.c') (more/less context) (ignore whitespace changes)
-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
@@ -98,24 +98,25 @@ struct repoinfo *add_repo(const char *url)
ret = &cgit_repolist.repos[cgit_repolist.count-1];
ret->url = xstrdup(url);
ret->name = ret->url;
ret->path = NULL;
ret->desc = NULL;
ret->owner = NULL;
ret->group = cgit_repo_group;
ret->defbranch = "master";
ret->snapshots = cgit_snapshots;
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;
}
struct repoinfo *cgit_get_repoinfo(const char *url)
{
int i;
struct repoinfo *repo;
for (i=0; i<cgit_repolist.count; i++) {
repo = &cgit_repolist.repos[i];
if (!strcmp(repo->url, url))
return repo;
@@ -178,25 +179,30 @@ void cgit_global_config_cb(const char *name, const char *value)
else if (cgit_repo && !strcmp(name, "repo.owner"))
cgit_repo->owner = xstrdup(value);
else if (cgit_repo && !strcmp(name, "repo.defbranch"))
cgit_repo->defbranch = xstrdup(value);
else if (cgit_repo && !strcmp(name, "repo.snapshots"))
cgit_repo->snapshots = cgit_snapshots * atoi(value);
else if (cgit_repo && !strcmp(name, "repo.enable-log-filecount"))
cgit_repo->enable_log_filecount = cgit_enable_log_filecount * atoi(value);
else if (cgit_repo && !strcmp(name, "repo.enable-log-linecount"))
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);
}
void cgit_querystring_cb(const char *name, const char *value)
{
if (!strcmp(name,"r")) {
cgit_query_repo = xstrdup(value);
cgit_repo = cgit_get_repoinfo(value);
} else if (!strcmp(name, "p")) {
cgit_query_page = xstrdup(value);
cgit_cmd = cgit_get_cmd_index(value);
} else if (!strcmp(name, "url")) {