#include "scan-tree.h"
#include "configfile.h"
#include "html.h"
+#include <config.h>
/* return 1 if path contains a objects/ directory and a HEAD file */
static int is_git_dir(const char *path)
static struct cgit_repo *repo;
static repo_config_fn config_fn;
-static void repo_config(const char *name, const char *value)
+static void scan_tree_repo_config(const char *name, const char *value)
{
config_fn(repo, name, value);
}
static int gitconfig_config(const char *key, const char *value, void *cb)
{
+ const char *name;
+
if (!strcmp(key, "gitweb.owner"))
config_fn(repo, "owner", value);
else if (!strcmp(key, "gitweb.description"))
config_fn(repo, "section", value);
else if (!strcmp(key, "gitweb.homepage"))
config_fn(repo, "homepage", value);
- else if (starts_with(key, "cgit."))
- config_fn(repo, key + 5, value);
+ else if (skip_prefix(key, "cgit.", &name))
+ config_fn(repo, name, value);
return 0;
}
strbuf_addstr(path, "cgitrc");
if (!stat(path->buf, &st))
- parse_configfile(path->buf, &repo_config);
+ parse_configfile(path->buf, &scan_tree_repo_config);
strbuf_release(&rel);
}
projectsfile, strerror(errno), errno);
return;
}
- while (strbuf_getline(&line, projects, '\n') != EOF) {
+ while (strbuf_getline(&line, projects) != EOF) {
if (!line.len)
continue;
strbuf_insert(&line, 0, "/", 1);