From 6fdd3c789aa039a1439ec65bdde6a56ddd88c59d Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Wed, 4 Nov 2026 22:33:58 -1000 Subject: Report a snapshot format name that matches nothing --- tests/t0205-config.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests') diff --git a/tests/t0205-config.sh b/tests/t0205-config.sh index 5044148..129b8de 100755 --- a/tests/t0205-config.sh +++ b/tests/t0205-config.sh @@ -179,6 +179,25 @@ 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 ' +# A snapshot format name that matches nothing used to drop out without a +# word, so a typo read like a format left off on purpose. The legacy 0 for +# none stays quiet, and a leading number other than 0 still means tar alone. +test_expect_success 'an unknown snapshot format is reported' ' + cgitrc_repo snaprc snap "snapshots=tar zap tar.gz" \ + "repo.path=$PWD/repos/foo/.git" "repo.snapshots=tar 0 tar.gzz" && + cgit_rc snaprc "url=snap/commit/" >tmp 2>err && + grep "href=./snap/snapshot/snap-master.tar.>" tmp && + ! grep "snap-master.tar.gz" tmp && + grep "Ignoring unknown snapshot format zap in $PWD/snaprc line 3" err && + grep "Ignoring unknown snapshot format tar.gzz in $PWD/snaprc line 6" err && + test_line_count = 2 err && + cgitrc_repo legacyrc snap "snapshots=2 zip" "repo.path=$PWD/repos/foo/.git" && + cgit_rc legacyrc "url=snap/commit/" >tmp 2>err && + grep "href=./snap/snapshot/snap-master.tar.>" tmp && + ! grep "snap-master.zip" tmp && + test_must_be_empty 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 2.12.1