a more 'modern' version of cgit
Log | Files | Refs | Submodules | README | LICENSE | git clone

commit 9d751e7eec4f4bc7292be46f2af774fe1adf336a
parent 1649afdc9b2febe9ab7e1abe1956c5dcaff93aa1
Author: John Keeping <>
Date:   Sat, 14 Oct 2017 13:02:53 +0100

parsing: don't clear existing state with empty input

Since commit c699866 (parsing: clear query path before starting,
2017-02-19), we clear the "page" variable simply by calling
cgit_parse_url() even if the URL is empty.  This breaks a URL like:


which is generated when using the "root-readme" configuration option.

This happens because "page" is set to "about" when parsing the query
string before we handle the path (which is empty, but non-null).

It turns out that this is not the only case which is broken, but
specifying repository and page via query options has been broken since
before the commit mentioned above, for example:


Fix both of these by allowing the previous state to persist if PATH_INFO
is empty, falling back to the query parameters if no path has been

Reported-by: Tom Ryder <>
Signed-off-by: John Keeping <>

Mparsing.c | 3+--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/parsing.c b/parsing.c @@ -20,11 +20,10 @@ void cgit_parse_url(const char *url) char *c, *cmd, *p; struct cgit_repo *repo; - ctx.repo = NULL; - = NULL; if (!url || url[0] == '\0') return; + = NULL; ctx.repo = cgit_get_repoinfo(url); if (ctx.repo) { ctx.qry.repo = ctx.repo->url;