return result;
}
-struct cgit_repo *repo;
-repo_config_fn config_fn;
+static struct cgit_repo *repo;
+static repo_config_fn config_fn;
static void repo_config(const char *name, const char *value)
{
else if (rel.len && rel.buf[rel.len - 1] == '/')
strbuf_setlen(&rel, rel.len - 1);
- fprintf(stderr, "add_repo(): %s\n", rel.buf);
repo = cgit_add_repo(rel.buf);
config_fn = fn;
if (ctx.cfg.enable_git_config) {
strbuf_setlen(path, pathlen);
}
- if (ctx.cfg.remove_suffix)
- if ((p = strrchr(repo->url, '.')) && !strcmp(p, ".git"))
- *p = '\0';
+ if (ctx.cfg.remove_suffix) {
+ size_t urllen;
+ strip_suffix(repo->url, ".git", &urllen);
+ strip_suffix_mem(repo->url, &urllen, "/");
+ repo->url[urllen] = '\0';
+ }
repo->path = xstrdup(path->buf);
while (!repo->owner) {
if ((pwd = getpwuid(st.st_uid)) == NULL) {
*slash = '\0';
repo->section = xstrdup(rel.buf);
*slash = '/';
- fprintf(stderr, "repo->name %s, repo->section %s\n", repo->name, repo->section);
if (starts_with(repo->name, repo->section)) {
repo->name += strlen(repo->section);
if (*repo->name == '/')
strbuf_addstr(path, "cgitrc");
if (!stat(path->buf, &st))
- parse_configfile(xstrdup(path->buf), &repo_config);
+ parse_configfile(path->buf, &repo_config);
strbuf_release(&rel);
}
size_t pathlen = strlen(path);
struct stat st;
- fprintf(stderr, "scan_path(): %s\n", path);
if (!dir) {
fprintf(stderr, "Error opening directory %s: %s (%d)\n",
path, strerror(errno), errno);
strbuf_add(&pathbuf, path, strlen(path));
if (is_git_dir(pathbuf.buf)) {
- fprintf(stderr, "scan_path() is_git_dir: %s\n", path);
add_repo(base, &pathbuf, fn);
goto end;
}