summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2009-08-24 05:42:03 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2009-08-24 08:22:58 (UTC)
commite01229cf80bc618a132d2154c0ebd71792d31c64 (patch) (unidiff)
tree62aa3f02166f7f4b6cdf866a4916b53921ed3ecf
parent74061ed5f03e72796450aa3b8ca1cf6ced5d59e2 (diff)
downloadcgit-e01229cf80bc618a132d2154c0ebd71792d31c64.zip
cgit-e01229cf80bc618a132d2154c0ebd71792d31c64.tar.gz
cgit-e01229cf80bc618a132d2154c0ebd71792d31c64.tar.bz2
ui-repolist: handle empty sections similar to NULL sections
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c1
-rw-r--r--ui-repolist.c18
2 files changed, 12 insertions, 7 deletions
diff --git a/cgit.c b/cgit.c
index e281aa9..167b5dd 100644
--- a/cgit.c
+++ b/cgit.c
@@ -269,6 +269,7 @@ static void prepare_context(struct cgit_context *ctx)
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;
diff --git a/ui-repolist.c b/ui-repolist.c
index d56654d..3ef2e99 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -217,6 +217,7 @@ 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)
@@ -247,19 +248,22 @@ void cgit_print_repolist()
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);