aboutsummaryrefslogtreecommitdiffstats
path: root/scan-tree.c
diff options
context:
space:
mode:
authorGravatar Jason A. Donenfeld <Jason@zx2c4.com>2012-07-11 12:32:45 (JST)
committerGravatar Jason A. Donenfeld <Jason@zx2c4.com>2012-07-13 03:01:46 (JST)
commitfc9181ff3d3ebbe0159871f6a49438e60bb17f58 (patch)
treea2b619e91112c9e8aaf03623a20f8e5c1aa36797 /scan-tree.c
parentb56be4ba3a942dd1978fe4bfecd9afc35aab0027 (diff)
downloadcgit-fc9181ff3d3ebbe0159871f6a49438e60bb17f58.zip
cgit-fc9181ff3d3ebbe0159871f6a49438e60bb17f58.tar.gz
scan-tree: Support gitweb.category.
Use gitweb.category from git config to determine repo's section, if option is enabled.
Diffstat (limited to 'scan-tree.c')
-rw-r--r--scan-tree.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/scan-tree.c b/scan-tree.c
index 3d4e417..50eedea 100644
--- a/scan-tree.c
+++ b/scan-tree.c
@@ -49,6 +49,7 @@ struct cgit_repo *repo;
49repo_config_fn config_fn; 49repo_config_fn config_fn;
50char *owner; 50char *owner;
51char *desc; 51char *desc;
52char *section;
52 53
53static void repo_config(const char *name, const char *value) 54static void repo_config(const char *name, const char *value)
54{ 55{
@@ -61,6 +62,8 @@ static int gitweb_config(const char *key, const char *value, void *cb)
61 owner = xstrdup(value); 62 owner = xstrdup(value);
62 else if (ctx.cfg.enable_gitweb_desc && !strcmp(key, "gitweb.description")) 63 else if (ctx.cfg.enable_gitweb_desc && !strcmp(key, "gitweb.description"))
63 desc = xstrdup(value); 64 desc = xstrdup(value);
65 else if (ctx.cfg.enable_gitweb_section && !strcmp(key, "gitweb.category"))
66 section = xstrdup(value);
64 return 0; 67 return 0;
65} 68}
66 69
@@ -95,6 +98,7 @@ static void add_repo(const char *base, const char *path, repo_config_fn fn)
95 98
96 owner = NULL; 99 owner = NULL;
97 desc = NULL; 100 desc = NULL;
101 section = NULL;
98 git_config_from_file(gitweb_config, fmt("%s/config", path), NULL); 102 git_config_from_file(gitweb_config, fmt("%s/config", path), NULL);
99 103
100 if (base == path) 104 if (base == path)
@@ -137,6 +141,8 @@ static void add_repo(const char *base, const char *path, repo_config_fn fn)
137 if (!stat(p, &st)) 141 if (!stat(p, &st))
138 repo->readme = "README.html"; 142 repo->readme = "README.html";
139 } 143 }
144 if (section)
145 repo->section = section;
140 if (ctx.cfg.section_from_path) { 146 if (ctx.cfg.section_from_path) {
141 n = ctx.cfg.section_from_path; 147 n = ctx.cfg.section_from_path;
142 if (n > 0) { 148 if (n > 0) {