X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/86bf5b47916fbe53fe637d7181e93a34d2ad6d0c..6feb1b669b381452c1c2b4723bfd18275ecae350:/scan-tree.c diff --git a/scan-tree.c b/scan-tree.c index 1cb4e5d..6a2f65a 100644 --- a/scan-tree.c +++ b/scan-tree.c @@ -10,6 +10,7 @@ #include "scan-tree.h" #include "configfile.h" #include "html.h" +#include /* return 1 if path contains a objects/ directory and a HEAD file */ static int is_git_dir(const char *path) @@ -48,13 +49,15 @@ out: static struct cgit_repo *repo; static repo_config_fn config_fn; -static void repo_config(const char *name, const char *value) +static void scan_tree_repo_config(const char *name, const char *value) { config_fn(repo, name, value); } static int gitconfig_config(const char *key, const char *value, void *cb) { + const char *name; + if (!strcmp(key, "gitweb.owner")) config_fn(repo, "owner", value); else if (!strcmp(key, "gitweb.description")) @@ -63,8 +66,8 @@ static int gitconfig_config(const char *key, const char *value, void *cb) config_fn(repo, "section", value); else if (!strcmp(key, "gitweb.homepage")) config_fn(repo, "homepage", value); - else if (starts_with(key, "cgit.")) - config_fn(repo, key + 5, value); + else if (skip_prefix(key, "cgit.", &name)) + config_fn(repo, name, value); return 0; } @@ -176,7 +179,7 @@ static void add_repo(const char *base, struct strbuf *path, repo_config_fn fn) strbuf_addstr(path, "cgitrc"); if (!stat(path->buf, &st)) - parse_configfile(path->buf, &repo_config); + parse_configfile(path->buf, &scan_tree_repo_config); strbuf_release(&rel); }