From b13a99f24c51c2ecc3e49b3061ea7eed182d9c1a Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 16 Oct 2026 06:09:01 -1000 Subject: Keep a repository with an empty url ignored The field resets at the end of cgit_add_repo cleared the ignore flag that the empty url branch had just set, so such a repository was listed on the index and selectable with ?r=, where every link to it read the byte before its url. --- source/shared.c | 1 - tests/t0303-robustness.sh | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source/shared.c b/source/shared.c index b68cbbf..befd3e5 100644 --- a/source/shared.c +++ b/source/shared.c @@ -261,7 +261,6 @@ struct cgit_repo *cgit_add_repo(const char *url) repo->trailer_filter = ctx.cfg.trailer_filter; repo->clone_url = ctx.cfg.clone_url; repo->submodules.strdup_strings = 1; - repo->hide = repo->ignore = 0; return repo; } diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh index 8dff969..e1b7b3a 100755 --- a/tests/t0303-robustness.sh +++ b/tests/t0303-robustness.sh @@ -43,12 +43,17 @@ test_expect_success 'a repository with an empty url is skipped with a warning' ' echo "cache-size=0" && echo "repo.url=" && echo "repo.path=$PWD/repos/rob/.git" && + echo "repo.desc=nourl" && echo "repo.url=rob" && echo "repo.path=$PWD/repos/rob/.git" } >nourlrc && CGIT_CONFIG="$PWD/nourlrc" QUERY_STRING="url=rob/" cgit >tmp 2>err && grep "^Status: 200" tmp && - grep "Ignoring repository with an empty url" err + grep "Ignoring repository with an empty url" err && + CGIT_CONFIG="$PWD/nourlrc" QUERY_STRING="url=" cgit >tmp && + ! grep nourl tmp && + CGIT_CONFIG="$PWD/nourlrc" QUERY_STRING="r=" cgit >tmp && + ! grep nourl tmp ' test_expect_success 'a scan path that is itself a repository is named after it' ' -- cgit