]> granicus.if.org Git - cgit/commitdiff
cgitrc: handle value "0" for max-repo-count ch/cgitrc
authorChristian Hesse <mail@eworm.de>
Mon, 16 Jul 2018 14:27:39 +0000 (16:27 +0200)
committerChristian Hesse <mail@eworm.de>
Wed, 21 Oct 2020 19:55:41 +0000 (21:55 +0200)
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>
cgit.c
cgitrc.5.txt

diff --git a/cgit.c b/cgit.c
index 08d81a1d4b632af9b725a0a2dbf553cff4d3e6b7..80570b599a9f017a788f468ef3e969afb0b8c70b 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -237,9 +237,11 @@ static void config_cb(const char *name, const char *value)
                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));
index 33a6a8c0c75832645a0d1c5b9b2b65d4d8cf2466..79a7095f5c19d03a07922c2918fee3641a6c0aa7 100644 (file)
@@ -269,7 +269,8 @@ max-message-length::
 
 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