+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, "desc", value);
+ else if (!strcmp(key, "gitweb.category"))
+ config_fn(repo, "section", value);
+ else if (!strcmp(key, "gitweb.homepage"))
+ config_fn(repo, "homepage", value);
+ else if (skip_prefix(key, "cgit.", &name))
+ config_fn(repo, name, value);
+
+ return 0;
+}
+
+static char *xstrrchr(char *s, char *from, int c)
+{
+ while (from >= s && *from != c)
+ from--;
+ return from < s ? NULL : from;
+}
+
+static void add_repo(const char *base, struct strbuf *path, repo_config_fn fn)