aboutsummaryrefslogtreecommitdiffstats
path: root/scan-tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'scan-tree.c')
-rw-r--r--scan-tree.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/scan-tree.c b/scan-tree.c
index 49de658..87fa0c7 100644
--- a/scan-tree.c
+++ b/scan-tree.c
@@ -61,7 +61,7 @@ static int gitconfig_config(const char *key, const char *value, void *cb)
61 config_fn(repo, "desc", value); 61 config_fn(repo, "desc", value);
62 else if (!strcmp(key, "gitweb.category")) 62 else if (!strcmp(key, "gitweb.category"))
63 config_fn(repo, "section", value); 63 config_fn(repo, "section", value);
64 else if (!prefixcmp(key, "cgit.")) 64 else if (starts_with(key, "cgit."))
65 config_fn(repo, key + 5, value); 65 config_fn(repo, key + 5, value);
66 66
67 return 0; 67 return 0;
@@ -105,7 +105,7 @@ static void add_repo(const char *base, struct strbuf *path, repo_config_fn fn)
105 return; 105 return;
106 strbuf_setlen(path, pathlen); 106 strbuf_setlen(path, pathlen);
107 107
108 if (prefixcmp(path->buf, base)) 108 if (!starts_with(path->buf, base))
109 strbuf_addbuf(&rel, path); 109 strbuf_addbuf(&rel, path);
110 else 110 else
111 strbuf_addstr(&rel, path->buf + strlen(base) + 1); 111 strbuf_addstr(&rel, path->buf + strlen(base) + 1);
@@ -115,6 +115,7 @@ static void add_repo(const char *base, struct strbuf *path, repo_config_fn fn)
115 else if (rel.len && rel.buf[rel.len - 1] == '/') 115 else if (rel.len && rel.buf[rel.len - 1] == '/')
116 strbuf_setlen(&rel, rel.len - 1); 116 strbuf_setlen(&rel, rel.len - 1);
117 117
118 fprintf(stderr, "add_repo(): %s\n", rel.buf);
118 repo = cgit_add_repo(rel.buf); 119 repo = cgit_add_repo(rel.buf);
119 config_fn = fn; 120 config_fn = fn;
120 if (ctx.cfg.enable_git_config) { 121 if (ctx.cfg.enable_git_config) {
@@ -161,7 +162,8 @@ static void add_repo(const char *base, struct strbuf *path, repo_config_fn fn)
161 *slash = '\0'; 162 *slash = '\0';
162 repo->section = xstrdup(rel.buf); 163 repo->section = xstrdup(rel.buf);
163 *slash = '/'; 164 *slash = '/';
164 if (!prefixcmp(repo->name, repo->section)) { 165 fprintf(stderr, "repo->name %s, repo->section %s\n", repo->name, repo->section);
166 if (starts_with(repo->name, repo->section)) {
165 repo->name += strlen(repo->section); 167 repo->name += strlen(repo->section);
166 if (*repo->name == '/') 168 if (*repo->name == '/')
167 repo->name++; 169 repo->name++;
@@ -184,6 +186,7 @@ static void scan_path(const char *base, const char *path, repo_config_fn fn)
184 size_t pathlen = strlen(path); 186 size_t pathlen = strlen(path);
185 struct stat st; 187 struct stat st;
186 188
189 fprintf(stderr, "scan_path(): %s\n", path);
187 if (!dir) { 190 if (!dir) {
188 fprintf(stderr, "Error opening directory %s: %s (%d)\n", 191 fprintf(stderr, "Error opening directory %s: %s (%d)\n",
189 path, strerror(errno), errno); 192 path, strerror(errno), errno);
@@ -192,6 +195,7 @@ static void scan_path(const char *base, const char *path, repo_config_fn fn)
192 195
193 strbuf_add(&pathbuf, path, strlen(path)); 196 strbuf_add(&pathbuf, path, strlen(path));
194 if (is_git_dir(pathbuf.buf)) { 197 if (is_git_dir(pathbuf.buf)) {
198 fprintf(stderr, "scan_path() is_git_dir: %s\n", path);
195 add_repo(base, &pathbuf, fn); 199 add_repo(base, &pathbuf, fn);
196 goto end; 200 goto end;
197 } 201 }