Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Let scan_tree choose the project list itself
Three callers wrote out the same choice, and the header already says a
scan visits only the listed paths when a project list is set.
Diffstat (limited to '')
| -rw-r--r-- | source/cgit.c | 15 | |
| -rw-r--r-- | source/scan-tree.c | 7 | |
| -rw-r--r-- | source/scan-tree.h | 1 |
3 files changed, 8 insertions, 15 deletions
diff --git a/source/cgit.c b/source/cgit.c index 11aef92..fd2a17a 100644 --- a/source/cgit.c +++ b/source/cgit.c @@ -384,10 +384,7 @@ static int generate_cached_repolist(const char *path, const char *cached_rc) goto out; } first = cgit_repolist.count; - if (ctx.cfg.project_list) - scan_projects(path, ctx.cfg.project_list); - else - scan_tree(path); + scan_tree(path); print_repolist(f, &cgit_repolist, first); // Flushed before the rename, because print_repolist writes through // stdio and a rename of the file would otherwise publish a repolist @@ -434,12 +431,8 @@ static void process_cached_repolist(const char *path) if (stat(cached_rc.buf, &st)) { // Nothing is cached yet, so this request scans in its own // process, leaving no copy behind when it cannot take the lock. - if (generate_cached_repolist(path, cached_rc.buf)) { - if (ctx.cfg.project_list) - scan_projects(path, ctx.cfg.project_list); - else - scan_tree(path); - } + if (generate_cached_repolist(path, cached_rc.buf)) + scan_tree(path); goto out; } @@ -634,8 +627,6 @@ static void apply_config(const char *name, const char *value) else if (!strcmp(name, "scan-path")) { if (ctx.cfg.cache_size) process_cached_repolist(cgit_expand_macros(value)); - else if (ctx.cfg.project_list) - scan_projects(cgit_expand_macros(value), ctx.cfg.project_list); else scan_tree(cgit_expand_macros(value)); // The scan grows the repository array, so a record taken before diff --git a/source/scan-tree.c b/source/scan-tree.c index 10f661d..ed50769 100644 --- a/source/scan-tree.c +++ b/source/scan-tree.c @@ -344,7 +344,7 @@ end: closedir(dir); } -void scan_projects(const char *path, const char *projectsfile) +static void scan_projects(const char *path, const char *projectsfile) { struct strbuf line = STRBUF_INIT; FILE *projects; @@ -374,5 +374,8 @@ void scan_projects(const char *path, const char *projectsfile) void scan_tree(const char *path) { - scan_path(path, path); + if (ctx.cfg.project_list) + scan_projects(path, ctx.cfg.project_list); + else + scan_path(path, path); } diff --git a/source/scan-tree.h b/source/scan-tree.h index 515037a..e29f8bf 100644 --- a/source/scan-tree.h +++ b/source/scan-tree.h @@ -10,7 +10,6 @@ #ifndef CGIT_SCAN_TREE_H #define CGIT_SCAN_TREE_H -extern void scan_projects(const char *path, const char *projectsfile); extern void scan_tree(const char *path); #endif // CGIT_SCAN_TREE_H |
