-rw-r--r-- | cgit.c | 1 | ||||
-rw-r--r-- | ui-repolist.c | 18 |
2 files changed, 12 insertions, 7 deletions
@@ -260,24 +260,25 @@ static void prepare_context(struct cgit_context *ctx) | |||
260 | ctx->cfg.max_repo_count = 50; | 260 | ctx->cfg.max_repo_count = 50; |
261 | ctx->cfg.max_commit_count = 50; | 261 | ctx->cfg.max_commit_count = 50; |
262 | ctx->cfg.max_lock_attempts = 5; | 262 | ctx->cfg.max_lock_attempts = 5; |
263 | ctx->cfg.max_msg_len = 80; | 263 | ctx->cfg.max_msg_len = 80; |
264 | ctx->cfg.max_repodesc_len = 80; | 264 | ctx->cfg.max_repodesc_len = 80; |
265 | ctx->cfg.max_stats = 0; | 265 | ctx->cfg.max_stats = 0; |
266 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; | 266 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; |
267 | ctx->cfg.renamelimit = -1; | 267 | ctx->cfg.renamelimit = -1; |
268 | ctx->cfg.robots = "index, nofollow"; | 268 | ctx->cfg.robots = "index, nofollow"; |
269 | ctx->cfg.root_title = "Git repository browser"; | 269 | ctx->cfg.root_title = "Git repository browser"; |
270 | ctx->cfg.root_desc = "a fast webinterface for the git dscm"; | 270 | ctx->cfg.root_desc = "a fast webinterface for the git dscm"; |
271 | ctx->cfg.script_name = CGIT_SCRIPT_NAME; | 271 | ctx->cfg.script_name = CGIT_SCRIPT_NAME; |
272 | ctx->cfg.section = ""; | ||
272 | ctx->cfg.summary_branches = 10; | 273 | ctx->cfg.summary_branches = 10; |
273 | ctx->cfg.summary_log = 10; | 274 | ctx->cfg.summary_log = 10; |
274 | ctx->cfg.summary_tags = 10; | 275 | ctx->cfg.summary_tags = 10; |
275 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); | 276 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); |
276 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); | 277 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); |
277 | ctx->env.https = xstrdupn(getenv("HTTPS")); | 278 | ctx->env.https = xstrdupn(getenv("HTTPS")); |
278 | ctx->env.no_http = xstrdupn(getenv("NO_HTTP")); | 279 | ctx->env.no_http = xstrdupn(getenv("NO_HTTP")); |
279 | ctx->env.path_info = xstrdupn(getenv("PATH_INFO")); | 280 | ctx->env.path_info = xstrdupn(getenv("PATH_INFO")); |
280 | ctx->env.query_string = xstrdupn(getenv("QUERY_STRING")); | 281 | ctx->env.query_string = xstrdupn(getenv("QUERY_STRING")); |
281 | ctx->env.request_method = xstrdupn(getenv("REQUEST_METHOD")); | 282 | ctx->env.request_method = xstrdupn(getenv("REQUEST_METHOD")); |
282 | ctx->env.script_name = xstrdupn(getenv("SCRIPT_NAME")); | 283 | ctx->env.script_name = xstrdupn(getenv("SCRIPT_NAME")); |
283 | ctx->env.server_name = xstrdupn(getenv("SERVER_NAME")); | 284 | ctx->env.server_name = xstrdupn(getenv("SERVER_NAME")); |
diff --git a/ui-repolist.c b/ui-repolist.c index d56654d..3ef2e99 100644 --- a/ui-repolist.c +++ b/ui-repolist.c | |||
@@ -208,24 +208,25 @@ int sort_repolist(char *field) | |||
208 | qsort(cgit_repolist.repos, cgit_repolist.count, | 208 | qsort(cgit_repolist.repos, cgit_repolist.count, |
209 | sizeof(struct cgit_repo), column->fn); | 209 | sizeof(struct cgit_repo), column->fn); |
210 | return 1; | 210 | return 1; |
211 | } | 211 | } |
212 | return 0; | 212 | return 0; |
213 | } | 213 | } |
214 | 214 | ||
215 | 215 | ||
216 | void cgit_print_repolist() | 216 | void cgit_print_repolist() |
217 | { | 217 | { |
218 | int i, columns = 4, hits = 0, header = 0; | 218 | int i, columns = 4, hits = 0, header = 0; |
219 | char *last_section = NULL; | 219 | char *last_section = NULL; |
220 | char *section; | ||
220 | int sorted = 0; | 221 | int sorted = 0; |
221 | 222 | ||
222 | if (ctx.cfg.enable_index_links) | 223 | if (ctx.cfg.enable_index_links) |
223 | columns++; | 224 | columns++; |
224 | 225 | ||
225 | ctx.page.title = ctx.cfg.root_title; | 226 | ctx.page.title = ctx.cfg.root_title; |
226 | cgit_print_http_headers(&ctx); | 227 | cgit_print_http_headers(&ctx); |
227 | cgit_print_docstart(&ctx); | 228 | cgit_print_docstart(&ctx); |
228 | cgit_print_pageheader(&ctx); | 229 | cgit_print_pageheader(&ctx); |
229 | 230 | ||
230 | if (ctx.cfg.index_header) | 231 | if (ctx.cfg.index_header) |
231 | html_include(ctx.cfg.index_header); | 232 | html_include(ctx.cfg.index_header); |
@@ -238,37 +239,40 @@ void cgit_print_repolist() | |||
238 | html("<table summary='repository list' class='list nowrap'>"); | 239 | html("<table summary='repository list' class='list nowrap'>"); |
239 | for (i=0; i<cgit_repolist.count; i++) { | 240 | for (i=0; i<cgit_repolist.count; i++) { |
240 | ctx.repo = &cgit_repolist.repos[i]; | 241 | ctx.repo = &cgit_repolist.repos[i]; |
241 | if (!(is_match(ctx.repo) && is_in_url(ctx.repo))) | 242 | if (!(is_match(ctx.repo) && is_in_url(ctx.repo))) |
242 | continue; | 243 | continue; |
243 | hits++; | 244 | hits++; |
244 | if (hits <= ctx.qry.ofs) | 245 | if (hits <= ctx.qry.ofs) |
245 | continue; | 246 | continue; |
246 | if (hits > ctx.qry.ofs + ctx.cfg.max_repo_count) | 247 | if (hits > ctx.qry.ofs + ctx.cfg.max_repo_count) |
247 | continue; | 248 | continue; |
248 | if (!header++) | 249 | if (!header++) |
249 | print_header(columns); | 250 | print_header(columns); |
251 | section = ctx.repo->section; | ||
252 | if (section && !strcmp(section, "")) | ||
253 | section = NULL; | ||
250 | if (!sorted && | 254 | if (!sorted && |
251 | ((last_section == NULL && ctx.repo->section != NULL) || | 255 | ((last_section == NULL && section != NULL) || |
252 | (last_section != NULL && ctx.repo->section == NULL) || | 256 | (last_section != NULL && section == NULL) || |
253 | (last_section != NULL && ctx.repo->section != NULL && | 257 | (last_section != NULL && section != NULL && |
254 | strcmp(ctx.repo->section, last_section)))) { | 258 | strcmp(section, last_section)))) { |
255 | htmlf("<tr class='nohover'><td colspan='%d' class='reposection'>", | 259 | htmlf("<tr class='nohover'><td colspan='%d' class='reposection'>", |
256 | columns); | 260 | columns); |
257 | html_txt(ctx.repo->section); | 261 | html_txt(section); |
258 | html("</td></tr>"); | 262 | html("</td></tr>"); |
259 | last_section = ctx.repo->section; | 263 | last_section = section; |
260 | } | 264 | } |
261 | htmlf("<tr><td class='%s'>", | 265 | htmlf("<tr><td class='%s'>", |
262 | !sorted && ctx.repo->section ? "sublevel-repo" : "toplevel-repo"); | 266 | !sorted && section ? "sublevel-repo" : "toplevel-repo"); |
263 | cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); | 267 | cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); |
264 | html("</td><td>"); | 268 | html("</td><td>"); |
265 | html_link_open(cgit_repourl(ctx.repo->url), NULL, NULL); | 269 | html_link_open(cgit_repourl(ctx.repo->url), NULL, NULL); |
266 | html_ntxt(ctx.cfg.max_repodesc_len, ctx.repo->desc); | 270 | html_ntxt(ctx.cfg.max_repodesc_len, ctx.repo->desc); |
267 | html_link_close(); | 271 | html_link_close(); |
268 | html("</td><td>"); | 272 | html("</td><td>"); |
269 | html_txt(ctx.repo->owner); | 273 | html_txt(ctx.repo->owner); |
270 | html("</td><td>"); | 274 | html("</td><td>"); |
271 | print_modtime(ctx.repo); | 275 | print_modtime(ctx.repo); |
272 | html("</td>"); | 276 | html("</td>"); |
273 | if (ctx.cfg.enable_index_links) { | 277 | if (ctx.cfg.enable_index_links) { |
274 | html("<td>"); | 278 | html("<td>"); |