Commit 91f25909b9572ebdf3a0fed8224bf03d0d9bf3db

Parents: 852cb3b0e267dd2ddfd2eeef6275435098c606e7

From: Christian Hesse <mail@eworm.de>
Date: Mon Jul 16 16:27:39 2018 +0700

cgitrc: handle value "0" for max-repo-count
Setting max-repo-count to "0" makes cgit loop forever generating page
links. Make this a special value to show all repositories.

Signed-off-by: Christian Hesse <mail@eworm.de>

Stats

cgit.c +4/-2
cgitrc.5.txt +2/-1

Changeset

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
diff --git a/cgit.c b/cgit.c
index 2de6d7f84c530f30851c2b3931eaec11ca722b1c..133f454b6dc0b46e74d3d753a4c910a07109e24e 100644
--- a/cgit.c
+++ b/cgit.c
@@ -237,9 +237,11 @@ 	else if (!strcmp(name, "max-repodesc-length"))
 		ctx.cfg.max_repodesc_len = atoi(value);
 	else if (!strcmp(name, "max-blob-size"))
 		ctx.cfg.max_blob_size = atoi(value);
-	else if (!strcmp(name, "max-repo-count"))
+	else if (!strcmp(name, "max-repo-count")) {
 		ctx.cfg.max_repo_count = atoi(value);
-	else if (!strcmp(name, "max-commit-count"))
+		if (ctx.cfg.max_repo_count <= 0)
+			ctx.cfg.max_repo_count = INT_MAX;
+	} else if (!strcmp(name, "max-commit-count"))
 		ctx.cfg.max_commit_count = atoi(value);
 	else if (!strcmp(name, "project-list"))
 		ctx.cfg.project_list = xstrdup(expand_macros(value));
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index d9eb3b02d322e67759fb413e0f9fd27375fbeab1..463d90ced9fe9c12fd477c936ed126a7e9f90eb0 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -269,7 +269,8 @@ 	"log" view. Default value: "80".
 
 max-repo-count::
 	Specifies the number of entries to list per page on the	repository
-	index page. Default value: "50".
+	index page. The value "0" shows all repositories without limitation.
+	Default value: "50".
 
 max-repodesc-length::
 	Specifies the maximum number of repo description characters to display