[PATCH v2 2/8] ui-repolist: Remove conditional around print_header()

Tim Nordell tim.nordell at logicpd.com
Sat Mar 5 00:24:50 CET 2016


The code has since morphed from the original use case of the
conditional for deciding whether or not to print the header.
This is guaranteed to always pass due to the earlier check
in the function "any_repos_visible()" which emits a 404
page.

Signed-off-by: Tim Nordell <tim.nordell at logicpd.com>

diff --git a/ui-repolist.c b/ui-repolist.c
index 771b330..c240af3 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -272,7 +272,7 @@ static int sort_repolist(char *field)
 
 void cgit_print_repolist(void)
 {
-	int i, columns = 3, hits = 0, header = 0;
+	int i, columns = 3, hits = 0;
 	char *last_section = NULL;
 	char *section;
 	int sorted = 0;
@@ -301,6 +301,7 @@ void cgit_print_repolist(void)
 		sort_repolist("section");
 
 	html("<table summary='repository list' class='list nowrap'>");
+	print_header();
 	for (i = 0; i < cgit_repolist.count; i++) {
 		ctx.repo = &cgit_repolist.repos[i];
 		if (!is_visible(ctx.repo))
@@ -310,8 +311,6 @@ void cgit_print_repolist(void)
 			continue;
 		if (hits > ctx.qry.ofs + ctx.cfg.max_repo_count)
 			continue;
-		if (!header++)
-			print_header();
 		section = ctx.repo->section;
 		if (section && !strcmp(section, ""))
 			section = NULL;
-- 
2.4.9



More information about the CGit mailing list