From 052e88d2f5a2866699f6b756f4bd98b99c602276 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 14:18:15 -0700 Subject: Ask for every path below the about page in one test All of them stop at the same early return in about_fn, so each now gets the status, the html error page and a clean log. --- tests/t0303-robustness.sh | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) (limited to 'tests') diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh index 5fc7002..5348b43 100755 --- a/tests/t0303-robustness.sh +++ b/tests/t0303-robustness.sh @@ -227,7 +227,9 @@ test_expect_success 'a commit encoding header is read without its newline' ' grep "
caf$(printf "\303\251")<" tmp ' -test_expect_success 'a submodule below the about path does not end the request' ' +# The about page shows the readme alone and its links lead into the tree, +# so a path below it names nothing, the site about page included. +test_expect_success 'a path below the about page answers 404' ' ( cd repos/rob && git update-index --add --cacheinfo 160000,$sha,sub && @@ -238,15 +240,15 @@ test_expect_success 'a submodule below the about path does not end the request' cat robrc && echo "repo.readme=master:file-1" } >aboutrc && - CGIT_CONFIG="$PWD/aboutrc" QUERY_STRING="url=rob/about/sub" cgit >tmp 2>err && - grep "^Status: 404" tmp && - ! grep "fatal" err -' - -test_expect_success 'a missing image on the about page errors as html' ' - CGIT_CONFIG="$PWD/aboutrc" QUERY_STRING="url=rob/about/missing.png" cgit >tmp && - grep "^Status: 404" tmp && - grep "^Content-Type: text/html" tmp + for path in sub sub/ missing.png file-1 ../robrc + do + CGIT_CONFIG="$PWD/aboutrc" QUERY_STRING="url=rob/about/$path" cgit >tmp 2>err && + grep "^Status: 404" tmp && + grep "^Content-Type: text/html" tmp && + ! grep fatal err || return 1 + done && + CGIT_CONFIG="$PWD/aboutrc" QUERY_STRING="p=about&path=x" cgit >tmp && + grep "^Status: 404" tmp ' test_expect_success 'a snapshot name holding a slash is refused' ' @@ -693,18 +695,6 @@ test_expect_success 'the about redirect encodes the repository url once' ' grep "^Location: /foo%2Bbar/$" tmp ' -# The about page shows the readme alone and its links lead into the tree, -# so a path below it names nothing, the site about page included. -test_expect_success 'a path below the about page answers 404' ' - for path in file-1 sub/ ../robrc - do - CGIT_CONFIG="$PWD/aboutrc" QUERY_STRING="url=rob/about/$path" cgit >tmp && - grep "^Status: 404" tmp || return 1 - done && - CGIT_CONFIG="$PWD/aboutrc" QUERY_STRING="p=about&path=x" cgit >tmp && - grep "^Status: 404" tmp -' - test_expect_success 'a symlink whose target is a large blob is listed without it' ' big=$(head -c 5000 /dev/zero | tr "\0" a | git -C repos/rob hash-object -w --stdin) && ( -- cgit