author | Lars Hjemli <hjemli@gmail.com> | 2010-02-28 17:40:02 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2010-02-28 17:40:02 (UTC) |
commit | 31ba37c0a44f152005fbb8ab49c05462fb741fd6 (patch) (side-by-side diff) | |
tree | 1270e4a66e4a436c7802795ec3c420dad4fa1894 | |
parent | c151ce61d87c577ac8a067523a406938c557d650 (diff) | |
download | cgit-31ba37c0a44f152005fbb8ab49c05462fb741fd6.zip cgit-31ba37c0a44f152005fbb8ab49c05462fb741fd6.tar.gz cgit-31ba37c0a44f152005fbb8ab49c05462fb741fd6.tar.bz2 |
scan-tree: add test for noweb-file in repo dir
If such a file exists, the repo is not added to the repolist.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | scan-tree.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/scan-tree.c b/scan-tree.c index dbca797..1e18f3c 100644 --- a/scan-tree.c +++ b/scan-tree.c @@ -35,48 +35,50 @@ 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) { struct stat st; struct passwd *pwd; char *p; size_t size; if (stat(path, &st)) { fprintf(stderr, "Error accessing %s: %s (%d)\n", path, strerror(errno), errno); return; } + if (!stat(fmt("%s/noweb", path), &st)) + return; if ((pwd = getpwuid(st.st_uid)) == NULL) { fprintf(stderr, "Error reading owner-info for %s: %s (%d)\n", path, strerror(errno), errno); return; } if (base == path) p = fmt("%s", path); else p = fmt("%s", path + strlen(base) + 1); if (!strcmp(p + strlen(p) - 5, "/.git")) p[strlen(p) - 5] = '\0'; repo = cgit_add_repo(xstrdup(p)); repo->name = repo->url; repo->path = xstrdup(path); p = (pwd && pwd->pw_gecos) ? strchr(pwd->pw_gecos, ',') : NULL; if (p) *p = '\0'; repo->owner = (pwd ? xstrdup(pwd->pw_gecos ? pwd->pw_gecos : pwd->pw_name) : ""); p = fmt("%s/description", path); if (!stat(p, &st)) readfile(p, &repo->desc, &size); |