-rw-r--r-- | cgit.c | 4 | ||||
-rw-r--r-- | cgit.css | 2 | ||||
-rw-r--r-- | cgit.h | 4 | ||||
-rw-r--r-- | cgitrc.5.txt | 9 | ||||
-rw-r--r-- | shared.c | 2 | ||||
-rw-r--r-- | ui-repolist.c | 18 |
6 files changed, 22 insertions, 17 deletions
@@ -134,26 +134,26 @@ void config_cb(const char *name, const char *value) | |||
134 | else if (!strcmp(name, "agefile")) | 134 | else if (!strcmp(name, "agefile")) |
135 | ctx.cfg.agefile = xstrdup(value); | 135 | ctx.cfg.agefile = xstrdup(value); |
136 | else if (!strcmp(name, "renamelimit")) | 136 | else if (!strcmp(name, "renamelimit")) |
137 | ctx.cfg.renamelimit = atoi(value); | 137 | ctx.cfg.renamelimit = atoi(value); |
138 | else if (!strcmp(name, "robots")) | 138 | else if (!strcmp(name, "robots")) |
139 | ctx.cfg.robots = xstrdup(value); | 139 | ctx.cfg.robots = xstrdup(value); |
140 | else if (!strcmp(name, "clone-prefix")) | 140 | else if (!strcmp(name, "clone-prefix")) |
141 | ctx.cfg.clone_prefix = xstrdup(value); | 141 | ctx.cfg.clone_prefix = xstrdup(value); |
142 | else if (!strcmp(name, "local-time")) | 142 | else if (!strcmp(name, "local-time")) |
143 | ctx.cfg.local_time = atoi(value); | 143 | ctx.cfg.local_time = atoi(value); |
144 | else if (!prefixcmp(name, "mimetype.")) | 144 | else if (!prefixcmp(name, "mimetype.")) |
145 | add_mimetype(name + 9, value); | 145 | add_mimetype(name + 9, value); |
146 | else if (!strcmp(name, "repo.group")) | 146 | else if (!strcmp(name, "section") || !strcmp(name, "repo.group")) |
147 | ctx.cfg.repo_group = xstrdup(value); | 147 | ctx.cfg.section = xstrdup(value); |
148 | else if (!strcmp(name, "repo.url")) | 148 | else if (!strcmp(name, "repo.url")) |
149 | ctx.repo = cgit_add_repo(value); | 149 | ctx.repo = cgit_add_repo(value); |
150 | else if (!strcmp(name, "repo.name")) | 150 | else if (!strcmp(name, "repo.name")) |
151 | ctx.repo->name = xstrdup(value); | 151 | ctx.repo->name = xstrdup(value); |
152 | else if (ctx.repo && !strcmp(name, "repo.path")) | 152 | else if (ctx.repo && !strcmp(name, "repo.path")) |
153 | ctx.repo->path = trim_end(value, '/'); | 153 | ctx.repo->path = trim_end(value, '/'); |
154 | else if (ctx.repo && !strcmp(name, "repo.clone-url")) | 154 | else if (ctx.repo && !strcmp(name, "repo.clone-url")) |
155 | ctx.repo->clone_url = xstrdup(value); | 155 | ctx.repo->clone_url = xstrdup(value); |
156 | else if (ctx.repo && !strcmp(name, "repo.desc")) | 156 | else if (ctx.repo && !strcmp(name, "repo.desc")) |
157 | ctx.repo->desc = xstrdup(value); | 157 | ctx.repo->desc = xstrdup(value); |
158 | else if (ctx.repo && !strcmp(name, "repo.owner")) | 158 | else if (ctx.repo && !strcmp(name, "repo.owner")) |
159 | ctx.repo->owner = xstrdup(value); | 159 | ctx.repo->owner = xstrdup(value); |
@@ -420,25 +420,25 @@ table.diff td div.del { | |||
420 | font-family: monospace; | 420 | font-family: monospace; |
421 | font-size: 90%; | 421 | font-size: 90%; |
422 | } | 422 | } |
423 | 423 | ||
424 | .left { | 424 | .left { |
425 | text-align: left; | 425 | text-align: left; |
426 | } | 426 | } |
427 | 427 | ||
428 | .right { | 428 | .right { |
429 | text-align: right; | 429 | text-align: right; |
430 | } | 430 | } |
431 | 431 | ||
432 | table.list td.repogroup { | 432 | table.list td.reposection { |
433 | font-style: italic; | 433 | font-style: italic; |
434 | color: #888; | 434 | color: #888; |
435 | } | 435 | } |
436 | 436 | ||
437 | a.button { | 437 | a.button { |
438 | font-size: 80%; | 438 | font-size: 80%; |
439 | padding: 0em 0.5em; | 439 | padding: 0em 0.5em; |
440 | } | 440 | } |
441 | 441 | ||
442 | a.primary { | 442 | a.primary { |
443 | font-size: 100%; | 443 | font-size: 100%; |
444 | } | 444 | } |
@@ -56,27 +56,27 @@ struct cgit_filter { | |||
56 | int pipe_fh[2]; | 56 | int pipe_fh[2]; |
57 | int pid; | 57 | int pid; |
58 | int exitstatus; | 58 | int exitstatus; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | struct cgit_repo { | 61 | struct cgit_repo { |
62 | char *url; | 62 | char *url; |
63 | char *name; | 63 | char *name; |
64 | char *path; | 64 | char *path; |
65 | char *desc; | 65 | char *desc; |
66 | char *owner; | 66 | char *owner; |
67 | char *defbranch; | 67 | char *defbranch; |
68 | char *group; | ||
69 | char *module_link; | 68 | char *module_link; |
70 | char *readme; | 69 | char *readme; |
70 | char *section; | ||
71 | char *clone_url; | 71 | char *clone_url; |
72 | int snapshots; | 72 | int snapshots; |
73 | int enable_log_filecount; | 73 | int enable_log_filecount; |
74 | int enable_log_linecount; | 74 | int enable_log_linecount; |
75 | int max_stats; | 75 | int max_stats; |
76 | time_t mtime; | 76 | time_t mtime; |
77 | struct cgit_filter *about_filter; | 77 | struct cgit_filter *about_filter; |
78 | struct cgit_filter *commit_filter; | 78 | struct cgit_filter *commit_filter; |
79 | struct cgit_filter *source_filter; | 79 | struct cgit_filter *source_filter; |
80 | }; | 80 | }; |
81 | 81 | ||
82 | struct cgit_repolist { | 82 | struct cgit_repolist { |
@@ -147,30 +147,30 @@ struct cgit_config { | |||
147 | char *cache_root; | 147 | char *cache_root; |
148 | char *clone_prefix; | 148 | char *clone_prefix; |
149 | char *css; | 149 | char *css; |
150 | char *favicon; | 150 | char *favicon; |
151 | char *footer; | 151 | char *footer; |
152 | char *head_include; | 152 | char *head_include; |
153 | char *header; | 153 | char *header; |
154 | char *index_header; | 154 | char *index_header; |
155 | char *index_info; | 155 | char *index_info; |
156 | char *logo; | 156 | char *logo; |
157 | char *logo_link; | 157 | char *logo_link; |
158 | char *module_link; | 158 | char *module_link; |
159 | char *repo_group; | ||
160 | char *robots; | 159 | char *robots; |
161 | char *root_title; | 160 | char *root_title; |
162 | char *root_desc; | 161 | char *root_desc; |
163 | char *root_readme; | 162 | char *root_readme; |
164 | char *script_name; | 163 | char *script_name; |
164 | char *section; | ||
165 | char *virtual_root; | 165 | char *virtual_root; |
166 | int cache_size; | 166 | int cache_size; |
167 | int cache_dynamic_ttl; | 167 | int cache_dynamic_ttl; |
168 | int cache_max_create_time; | 168 | int cache_max_create_time; |
169 | int cache_repo_ttl; | 169 | int cache_repo_ttl; |
170 | int cache_root_ttl; | 170 | int cache_root_ttl; |
171 | int cache_scanrc_ttl; | 171 | int cache_scanrc_ttl; |
172 | int cache_static_ttl; | 172 | int cache_static_ttl; |
173 | int embedded; | 173 | int embedded; |
174 | int enable_index_links; | 174 | int enable_index_links; |
175 | int enable_log_filecount; | 175 | int enable_log_filecount; |
176 | int enable_log_linecount; | 176 | int enable_log_linecount; |
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 2abbd41..4d009f9 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
@@ -191,49 +191,54 @@ noplainemail:: | |||
191 | Default value: "0". | 191 | Default value: "0". |
192 | 192 | ||
193 | noheader:: | 193 | noheader:: |
194 | Flag which, when set to "1", will make cgit omit the standard header | 194 | Flag which, when set to "1", will make cgit omit the standard header |
195 | on all pages. Default value: none. See also: "embedded". | 195 | on all pages. Default value: none. See also: "embedded". |
196 | 196 | ||
197 | renamelimit:: | 197 | renamelimit:: |
198 | Maximum number of files to consider when detecting renames. The value | 198 | Maximum number of files to consider when detecting renames. The value |
199 | "-1" uses the compiletime value in git (for further info, look at | 199 | "-1" uses the compiletime value in git (for further info, look at |
200 | `man git-diff`). Default value: "-1". | 200 | `man git-diff`). Default value: "-1". |
201 | 201 | ||
202 | repo.group:: | 202 | repo.group:: |
203 | A value for the current repository group, which all repositories | 203 | Legacy alias for 'section' which will be deprecated starting with |
204 | specified after this setting will inherit. Default value: none. | 204 | cgit-1.0. |
205 | 205 | ||
206 | robots:: | 206 | robots:: |
207 | Text used as content for the "robots" meta-tag. Default value: | 207 | Text used as content for the "robots" meta-tag. Default value: |
208 | "index, nofollow". | 208 | "index, nofollow". |
209 | 209 | ||
210 | root-desc:: | 210 | root-desc:: |
211 | Text printed below the heading on the repository index page. Default | 211 | Text printed below the heading on the repository index page. Default |
212 | value: "a fast webinterface for the git dscm". | 212 | value: "a fast webinterface for the git dscm". |
213 | 213 | ||
214 | root-readme:: | 214 | root-readme:: |
215 | The content of the file specified with this option will be included | 215 | The content of the file specified with this option will be included |
216 | verbatim below the "about" link on the repository index page. Default | 216 | verbatim below the "about" link on the repository index page. Default |
217 | value: none. | 217 | value: none. |
218 | 218 | ||
219 | root-title:: | 219 | root-title:: |
220 | Text printed as heading on the repository index page. Default value: | 220 | Text printed as heading on the repository index page. Default value: |
221 | "Git Repository Browser". | 221 | "Git Repository Browser". |
222 | 222 | ||
223 | scan-path:: | 223 | scan-path:: |
224 | A path which will be scanned for repositories. If caching is enabled, | 224 | A path which will be scanned for repositories. If caching is enabled, |
225 | the result will be cached as a cgitrc include-file in the cache | 225 | the result will be cached as a cgitrc include-file in the cache |
226 | directory. Default value: none. See also: cache-scanrc-ttl. | 226 | directory. Default value: none. See also: cache-scanrc-ttl. |
227 | 227 | ||
228 | section: | ||
229 | The name of the current repository section - all repositories defined | ||
230 | after this option will inherit the current section name. Default value: | ||
231 | none. | ||
232 | |||
228 | snapshots:: | 233 | snapshots:: |
229 | Text which specifies the default set of snapshot formats generated by | 234 | Text which specifies the default set of snapshot formats generated by |
230 | cgit. The value is a space-separated list of zero or more of the | 235 | cgit. The value is a space-separated list of zero or more of the |
231 | values "tar", "tar.gz", "tar.bz2" and "zip". Default value: none. | 236 | values "tar", "tar.gz", "tar.bz2" and "zip". Default value: none. |
232 | 237 | ||
233 | source-filter:: | 238 | source-filter:: |
234 | Specifies a command which will be invoked to format plaintext blobs | 239 | Specifies a command which will be invoked to format plaintext blobs |
235 | in the tree view. The command will get the blob content on its STDIN | 240 | in the tree view. The command will get the blob content on its STDIN |
236 | and the name of the blob as its only command line argument. The STDOUT | 241 | and the name of the blob as its only command line argument. The STDOUT |
237 | from the command will be included verbatim as the blob contents, i.e. | 242 | from the command will be included verbatim as the blob contents, i.e. |
238 | this can be used to implement e.g. syntax highlighting. Default value: | 243 | this can be used to implement e.g. syntax highlighting. Default value: |
239 | none. | 244 | none. |
@@ -44,25 +44,25 @@ struct cgit_repo *cgit_add_repo(const char *url) | |||
44 | cgit_repolist.length *= 2; | 44 | cgit_repolist.length *= 2; |
45 | cgit_repolist.repos = xrealloc(cgit_repolist.repos, | 45 | cgit_repolist.repos = xrealloc(cgit_repolist.repos, |
46 | cgit_repolist.length * | 46 | cgit_repolist.length * |
47 | sizeof(struct cgit_repo)); | 47 | sizeof(struct cgit_repo)); |
48 | } | 48 | } |
49 | 49 | ||
50 | ret = &cgit_repolist.repos[cgit_repolist.count-1]; | 50 | ret = &cgit_repolist.repos[cgit_repolist.count-1]; |
51 | ret->url = trim_end(url, '/'); | 51 | ret->url = trim_end(url, '/'); |
52 | ret->name = ret->url; | 52 | ret->name = ret->url; |
53 | ret->path = NULL; | 53 | ret->path = NULL; |
54 | ret->desc = "[no description]"; | 54 | ret->desc = "[no description]"; |
55 | ret->owner = NULL; | 55 | ret->owner = NULL; |
56 | ret->group = ctx.cfg.repo_group; | 56 | ret->section = ctx.cfg.section; |
57 | ret->defbranch = "master"; | 57 | ret->defbranch = "master"; |
58 | ret->snapshots = ctx.cfg.snapshots; | 58 | ret->snapshots = ctx.cfg.snapshots; |
59 | ret->enable_log_filecount = ctx.cfg.enable_log_filecount; | 59 | ret->enable_log_filecount = ctx.cfg.enable_log_filecount; |
60 | ret->enable_log_linecount = ctx.cfg.enable_log_linecount; | 60 | ret->enable_log_linecount = ctx.cfg.enable_log_linecount; |
61 | ret->max_stats = ctx.cfg.max_stats; | 61 | ret->max_stats = ctx.cfg.max_stats; |
62 | ret->module_link = ctx.cfg.module_link; | 62 | ret->module_link = ctx.cfg.module_link; |
63 | ret->readme = NULL; | 63 | ret->readme = NULL; |
64 | ret->mtime = -1; | 64 | ret->mtime = -1; |
65 | ret->about_filter = ctx.cfg.about_filter; | 65 | ret->about_filter = ctx.cfg.about_filter; |
66 | ret->commit_filter = ctx.cfg.commit_filter; | 66 | ret->commit_filter = ctx.cfg.commit_filter; |
67 | ret->source_filter = ctx.cfg.source_filter; | 67 | ret->source_filter = ctx.cfg.source_filter; |
68 | return ret; | 68 | return ret; |
diff --git a/ui-repolist.c b/ui-repolist.c index 7c7aa9b..4dea3b3 100644 --- a/ui-repolist.c +++ b/ui-repolist.c | |||
@@ -194,25 +194,25 @@ int sort_repolist(char *field) | |||
194 | continue; | 194 | continue; |
195 | qsort(cgit_repolist.repos, cgit_repolist.count, | 195 | qsort(cgit_repolist.repos, cgit_repolist.count, |
196 | sizeof(struct cgit_repo), column->fn); | 196 | sizeof(struct cgit_repo), column->fn); |
197 | return 1; | 197 | return 1; |
198 | } | 198 | } |
199 | return 0; | 199 | return 0; |
200 | } | 200 | } |
201 | 201 | ||
202 | 202 | ||
203 | void cgit_print_repolist() | 203 | void cgit_print_repolist() |
204 | { | 204 | { |
205 | int i, columns = 4, hits = 0, header = 0; | 205 | int i, columns = 4, hits = 0, header = 0; |
206 | char *last_group = NULL; | 206 | char *last_section = NULL; |
207 | int sorted = 0; | 207 | int sorted = 0; |
208 | 208 | ||
209 | if (ctx.cfg.enable_index_links) | 209 | if (ctx.cfg.enable_index_links) |
210 | columns++; | 210 | columns++; |
211 | 211 | ||
212 | ctx.page.title = ctx.cfg.root_title; | 212 | ctx.page.title = ctx.cfg.root_title; |
213 | cgit_print_http_headers(&ctx); | 213 | cgit_print_http_headers(&ctx); |
214 | cgit_print_docstart(&ctx); | 214 | cgit_print_docstart(&ctx); |
215 | cgit_print_pageheader(&ctx); | 215 | cgit_print_pageheader(&ctx); |
216 | 216 | ||
217 | if (ctx.cfg.index_header) | 217 | if (ctx.cfg.index_header) |
218 | html_include(ctx.cfg.index_header); | 218 | html_include(ctx.cfg.index_header); |
@@ -224,36 +224,36 @@ void cgit_print_repolist() | |||
224 | for (i=0; i<cgit_repolist.count; i++) { | 224 | for (i=0; i<cgit_repolist.count; i++) { |
225 | ctx.repo = &cgit_repolist.repos[i]; | 225 | ctx.repo = &cgit_repolist.repos[i]; |
226 | if (!(is_match(ctx.repo) && is_in_url(ctx.repo))) | 226 | if (!(is_match(ctx.repo) && is_in_url(ctx.repo))) |
227 | continue; | 227 | continue; |
228 | hits++; | 228 | hits++; |
229 | if (hits <= ctx.qry.ofs) | 229 | if (hits <= ctx.qry.ofs) |
230 | continue; | 230 | continue; |
231 | if (hits > ctx.qry.ofs + ctx.cfg.max_repo_count) | 231 | if (hits > ctx.qry.ofs + ctx.cfg.max_repo_count) |
232 | continue; | 232 | continue; |
233 | if (!header++) | 233 | if (!header++) |
234 | print_header(columns); | 234 | print_header(columns); |
235 | if (!sorted && | 235 | if (!sorted && |
236 | ((last_group == NULL && ctx.repo->group != NULL) || | 236 | ((last_section == NULL && ctx.repo->section != NULL) || |
237 | (last_group != NULL && ctx.repo->group == NULL) || | 237 | (last_section != NULL && ctx.repo->section == NULL) || |
238 | (last_group != NULL && ctx.repo->group != NULL && | 238 | (last_section != NULL && ctx.repo->section != NULL && |
239 | strcmp(ctx.repo->group, last_group)))) { | 239 | strcmp(ctx.repo->section, last_section)))) { |
240 | htmlf("<tr class='nohover'><td colspan='%d' class='repogroup'>", | 240 | htmlf("<tr class='nohover'><td colspan='%d' class='reposection'>", |
241 | columns); | 241 | columns); |
242 | html_txt(ctx.repo->group); | 242 | html_txt(ctx.repo->section); |
243 | html("</td></tr>"); | 243 | html("</td></tr>"); |
244 | last_group = ctx.repo->group; | 244 | last_section = ctx.repo->section; |
245 | } | 245 | } |
246 | htmlf("<tr><td class='%s'>", | 246 | htmlf("<tr><td class='%s'>", |
247 | !sorted && ctx.repo->group ? "sublevel-repo" : "toplevel-repo"); | 247 | !sorted && ctx.repo->section ? "sublevel-repo" : "toplevel-repo"); |
248 | cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); | 248 | cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); |
249 | html("</td><td>"); | 249 | html("</td><td>"); |
250 | html_link_open(cgit_repourl(ctx.repo->url), NULL, NULL); | 250 | html_link_open(cgit_repourl(ctx.repo->url), NULL, NULL); |
251 | html_ntxt(ctx.cfg.max_repodesc_len, ctx.repo->desc); | 251 | html_ntxt(ctx.cfg.max_repodesc_len, ctx.repo->desc); |
252 | html_link_close(); | 252 | html_link_close(); |
253 | html("</td><td>"); | 253 | html("</td><td>"); |
254 | html_txt(ctx.repo->owner); | 254 | html_txt(ctx.repo->owner); |
255 | html("</td><td>"); | 255 | html("</td><td>"); |
256 | print_modtime(ctx.repo); | 256 | print_modtime(ctx.repo); |
257 | html("</td>"); | 257 | html("</td>"); |
258 | if (ctx.cfg.enable_index_links) { | 258 | if (ctx.cfg.enable_index_links) { |
259 | html("<td>"); | 259 | html("<td>"); |