-rw-r--r-- | cgit.c | 1 | ||||
-rw-r--r-- | ui-repolist.c | 18 |
2 files changed, 12 insertions, 7 deletions
@@ -266,12 +266,13 @@ static void prepare_context(struct cgit_context *ctx) | |||
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")); |
diff --git a/ui-repolist.c b/ui-repolist.c index d56654d..3ef2e99 100644 --- a/ui-repolist.c +++ b/ui-repolist.c | |||
@@ -214,12 +214,13 @@ int sort_repolist(char *field) | |||
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; |
@@ -244,25 +245,28 @@ void cgit_print_repolist() | |||
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>"); |