Diffstat (limited to 'scan-tree.c')
| -rw-r--r-- | scan-tree.c | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/scan-tree.c b/scan-tree.c index dbca797..4da21a4 100644 --- a/scan-tree.c +++ b/scan-tree.c @@ -1,5 +1,4 @@ #include "cgit.h" -#include "configfile.h" #include "html.h" #define MAX_PATH 4096 @@ -36,16 +35,9 @@ static int is_git_dir(const char *path) return 1; } -struct cgit_repo *repo; -repo_config_fn config_fn; - -static void repo_config(const char *name, const char *value) -{ - config_fn(repo, name, value); -} - -static void add_repo(const char *base, const char *path, repo_config_fn fn) +static void add_repo(const char *base, const char *path) { + struct cgit_repo *repo; struct stat st; struct passwd *pwd; char *p; @@ -84,15 +76,9 @@ static void add_repo(const char *base, const char *path, repo_config_fn fn) p = fmt("%s/README.html", path); if (!stat(p, &st)) repo->readme = "README.html"; - - p = fmt("%s/cgitrc", path); - if (!stat(p, &st)) { - config_fn = fn; - parse_configfile(xstrdup(p), &repo_config); - } } -static void scan_path(const char *base, const char *path, repo_config_fn fn) +static void scan_path(const char *base, const char *path) { DIR *dir; struct dirent *ent; @@ -100,11 +86,7 @@ static void scan_path(const char *base, const char *path, repo_config_fn fn) struct stat st; if (is_git_dir(path)) { - add_repo(base, path, fn); - return; - } - if (is_git_dir(fmt("%s/.git", path))) { - add_repo(base, fmt("%s/.git", path), fn); + add_repo(base, path); return; } dir = opendir(path); @@ -134,13 +116,13 @@ static void scan_path(const char *base, const char *path, repo_config_fn fn) continue; } if (S_ISDIR(st.st_mode)) - scan_path(base, buf, fn); + scan_path(base, buf); free(buf); } closedir(dir); } -void scan_tree(const char *path, repo_config_fn fn) +void scan_tree(const char *path) { - scan_path(path, path, fn); + scan_path(path, path); } |