From 4627d6ce238678a24eb7dbe7814d0228f32fb3c8 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 20:07:18 -1000 Subject: Log the path of a repository that will not open The 404 page names only the repository and nothing reached the log, so a mistyped repo.path left no trace of the path cgit had tried. --- tests/t0205-config.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests') diff --git a/tests/t0205-config.sh b/tests/t0205-config.sh index 3b892e9..5044148 100755 --- a/tests/t0205-config.sh +++ b/tests/t0205-config.sh @@ -179,4 +179,18 @@ test_expect_success 'a word in a scanned git config is reported' ' grep "Reading hide=true in $PWD/wordscan/foo.git/config line $line as 0, since it is not a whole number" err ' +# The error page names the repository alone, so the log gets the path that +# would not open, once for the request. +test_expect_success 'a repository that will not open is logged with its path' ' + cgit_rc gonerc "url=gone/log/" >tmp 2>err && + grep "^Status: 404 Not Found" tmp && + grep "Unable to open repository gone at $PWD/no/such/repo/.git: No such file or directory" err && + test_line_count = 1 err && + mkdir not-a-repo && + cgitrc_repo notreporc notrepo "repo.path=$PWD/not-a-repo" && + cgit_rc notreporc "url=notrepo/" >tmp 2>err && + grep "^Status: 404 Not Found" tmp && + grep "Unable to open repository notrepo at $PWD/not-a-repo: " err +' + test_done -- cgit 2.12.1