From 723ba6c1ff41bcd12b679302b3a0776540e454a4 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Thu, 29 Oct 2026 13:31:07 -1000 Subject: Offer the versions as an option enable-version-info brings back the cgit and git versions that 3a00e19 took off the footer and the generator tag, for a site that wants them, and the version 2a6726a put on the signature of patches now follows it too. It stays off by default for the reason 3a00e19 gave. --- tests/t0109-patch.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'tests/t0109-patch.sh') diff --git a/tests/t0109-patch.sh b/tests/t0109-patch.sh index 0c4bf8c..6840f0c 100755 --- a/tests/t0109-patch.sh +++ b/tests/t0109-patch.sh @@ -12,9 +12,10 @@ test_description='Check content on patch page' # tag, as git writes its own. CGIT_VERSION=$(sed -n "s/CGIT_VERSION = v\{0,1\}//p" "$TEST_OUTPUT_DIRECTORY/../build/VERSION") -# The signature sits on the second-to-last line, above the trailing blank. +# The signature sits on the second-to-last line, above the trailing blank, +# and names the version only when enable-version-info asks for it. check_cgit_signature() { - tail -2 tmp | head -1 | grep -x -F "cgit $CGIT_VERSION" + tail -2 tmp | head -1 | grep -x -F "cgit${1:+ $1}" } test_expect_success 'generate foo/patch' ' @@ -39,7 +40,7 @@ test_expect_success 'find `cgit` signature' ' test_expect_success 'compare with output of git-format-patch(1)' ' git --git-dir="$PWD/repos/foo/.git" format-patch --subject-prefix="" \ - --signature="cgit $CGIT_VERSION" --stdout HEAD^ >tmp2 && + --signature="cgit" --stdout HEAD^ >tmp2 && strip_headers tmp_ && test_cmp tmp_ tmp2 ' @@ -68,7 +69,7 @@ test_expect_success 'find `cgit` signature on the range' ' test_expect_success 'compare the range with git-format-patch(1)' ' git --git-dir="$PWD/repos/foo/.git" format-patch --subject-prefix="" \ - -N --signature="cgit $CGIT_VERSION" --stdout HEAD~3..HEAD >tmp2 && + -N --signature="cgit" --stdout HEAD~3..HEAD >tmp2 && strip_headers tmp_ && test_cmp tmp_ tmp2 ' @@ -86,4 +87,13 @@ test_expect_success 'max-patch-count bounds a patch range' ' test $(grep -c "^From " tmp) -eq 2 ' +test_expect_success 'the signature names the version when asked to' ' + { + echo "enable-version-info=1" && + sed "s/^cache-size=.*/cache-size=0/" cgitrc + } >versionrc && + CGIT_CONFIG="$PWD/versionrc" QUERY_STRING="url=foo/patch" cgit >tmp && + check_cgit_signature "$CGIT_VERSION" +' + test_done -- cgit