summaryrefslogtreecommitdiffabout
path: root/cgit.c
authorLars Hjemli <hjemli@gmail.com>2010-08-04 01:10:29 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2010-08-04 01:10:29 (UTC)
commitaec9c245e7eaf444c7ae1851e3eda3b30748950f (patch) (side-by-side diff)
tree04d5e945781441f2589ae8eb44bee8d5a2b17c2b /cgit.c
parente6c960c7c0f0d2e54b51cc43ef190df3ce52755e (diff)
parent119397b175874bd606952e93b7249ae4ffb9afbe (diff)
downloadcgit-aec9c245e7eaf444c7ae1851e3eda3b30748950f.zip
cgit-aec9c245e7eaf444c7ae1851e3eda3b30748950f.tar.gz
cgit-aec9c245e7eaf444c7ae1851e3eda3b30748950f.tar.bz2
Merge branch 'jd/gitolite'
Diffstat (limited to 'cgit.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/cgit.c b/cgit.c
index c263872..eff5b7a 100644
--- a/cgit.c
+++ b/cgit.c
@@ -137,2 +137,4 @@ void config_cb(const char *name, const char *value)
ctx.cfg.enable_filter_overrides = atoi(value);
+ else if (!strcmp(name, "enable-gitweb-owner"))
+ ctx.cfg.enable_gitweb_owner = atoi(value);
else if (!strcmp(name, "enable-index-links"))
@@ -183,2 +185,4 @@ void config_cb(const char *name, const char *value)
ctx.cfg.max_commit_count = atoi(value);
+ else if (!strcmp(name, "project-list"))
+ ctx.cfg.project_list = xstrdup(expand_macros(value));
else if (!strcmp(name, "scan-path"))
@@ -186,2 +190,5 @@ void config_cb(const char *name, const char *value)
process_cached_repolist(expand_macros(value));
+ else if (ctx.cfg.project_list)
+ scan_projects(expand_macros(value),
+ ctx.cfg.project_list, repo_config);
else
@@ -202,2 +209,4 @@ void config_cb(const char *name, const char *value)
ctx.cfg.renamelimit = atoi(value);
+ else if (!strcmp(name, "remove-suffix"))
+ ctx.cfg.remove_suffix = atoi(value);
else if (!strcmp(name, "robots"))
@@ -288,2 +297,3 @@ static void prepare_context(struct cgit_context *ctx)
ctx->cfg.local_time = 0;
+ ctx->cfg.enable_gitweb_owner = 1;
ctx->cfg.enable_tree_linenumbers = 1;
@@ -297,3 +307,5 @@ static void prepare_context(struct cgit_context *ctx)
ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s";
+ ctx->cfg.project_list = NULL;
ctx->cfg.renamelimit = -1;
+ ctx->cfg.remove_suffix = 0;
ctx->cfg.robots = "index, nofollow";
@@ -576,3 +588,6 @@ static int generate_cached_repolist(const char *path, const char *cached_rc)
idx = cgit_repolist.count;
- scan_tree(path, repo_config);
+ if (ctx.cfg.project_list)
+ scan_projects(path, ctx.cfg.project_list, repo_config);
+ else
+ scan_tree(path, repo_config);
print_repolist(f, &cgit_repolist, idx);
@@ -590,5 +605,8 @@ static void process_cached_repolist(const char *path)
time_t age;
+ unsigned long hash;
- cached_rc = xstrdup(fmt("%s/rc-%8x", ctx.cfg.cache_root,
- hash_str(path)));
+ hash = hash_str(path);
+ if (ctx.cfg.project_list)
+ hash += hash_str(ctx.cfg.project_list);
+ cached_rc = xstrdup(fmt("%s/rc-%8x", ctx.cfg.cache_root, hash));
@@ -599,4 +617,9 @@ static void process_cached_repolist(const char *path)
*/
- if (generate_cached_repolist(path, cached_rc))
- scan_tree(path, repo_config);
+ if (generate_cached_repolist(path, cached_rc)) {
+ if (ctx.cfg.project_list)
+ scan_projects(path, ctx.cfg.project_list,
+ repo_config);
+ else
+ scan_tree(path, repo_config);
+ }
return;