From a1cb1d9e9fe6cb7417cc9c532dfb1b4da6851c07 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Mon, 21 Sep 2026 06:37:28 -1000 Subject: Answer 404 for a repository whose path is missing --- tests/t0205-config.sh | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'tests/t0205-config.sh') diff --git a/tests/t0205-config.sh b/tests/t0205-config.sh index 1a4f5d0..26231af 100755 --- a/tests/t0205-config.sh +++ b/tests/t0205-config.sh @@ -3,8 +3,9 @@ # Checks what the configuration parser reports on stderr. A key it does not # know, a repo key before any repository and a filter set by a scanned # repository without trust-scan-filters are each ignored with a warning naming -# the key, a repo filter in the main cgitrc passes without one, and a config -# cgit fully understands stays silent. +# the key, a repo filter in the main cgitrc passes without one, a repository +# whose path is missing answers 404 on every page, and a config cgit fully +# understands stays silent. test_description='Check configuration diagnostics' . ./setup.sh @@ -70,6 +71,24 @@ test_expect_success 'a repo filter in the main cgitrc needs no flag' ' ! grep "about-filter" err ' +test_expect_success 'a repository whose path is missing answers 404' ' + { + echo "virtual-root=/" && + echo "cache-size=1021" && + echo "cache-root=$PWD/gone-cache" && + echo "repo.url=gone" && + echo "repo.path=$PWD/no/such/repo/.git" + } >gonerc && + mkdir -p gone-cache && + for page in "" log/ commit/ "tag/&h=x" atom/ plain/f + do + CGIT_CONFIG="$PWD/gonerc" QUERY_STRING="url=gone/$page" cgit >tmp 2>err && + grep "^Status: 404 Not Found" tmp && + grep "Failed to open gone: No such file or directory" tmp || return 1 + done && + test -z "$(ls gone-cache)" +' + test_expect_success 'a fully understood config stays silent' ' cgit_url "foo/" >tmp 2>err && grep "Status: 200" tmp && -- cgit v2.8.0