From f7d2b838e9c37b96d705b631750fd1629ef1dab1 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Thu, 22 Oct 2026 22:58:51 -1000 Subject: Sign patches with the cgit version git format-patch ends each patch with the version of git that wrote it, and the bare "cgit" that 872bd7c left in its place said less. The version is written as git writes its own, without the v of the tag, so a release build signs with "cgit 2.9.0". The footer and the generator tag still leave versions out. --- tests/t0109-patch.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tests/t0109-patch.sh') diff --git a/tests/t0109-patch.sh b/tests/t0109-patch.sh index 3cb9d08..0c4bf8c 100755 --- a/tests/t0109-patch.sh +++ b/tests/t0109-patch.sh @@ -8,9 +8,13 @@ test_description='Check content on patch page' . ./setup.sh +# The version the built binary signs its patches with, without the v of the +# 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. check_cgit_signature() { - tail -2 tmp | head -1 | grep "^cgit$" + tail -2 tmp | head -1 | grep -x -F "cgit $CGIT_VERSION" } test_expect_success 'generate foo/patch' ' @@ -35,7 +39,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" --stdout HEAD^ >tmp2 && + --signature="cgit $CGIT_VERSION" --stdout HEAD^ >tmp2 && strip_headers tmp_ && test_cmp tmp_ tmp2 ' @@ -64,7 +68,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" --stdout HEAD~3..HEAD >tmp2 && + -N --signature="cgit $CGIT_VERSION" --stdout HEAD~3..HEAD >tmp2 && strip_headers tmp_ && test_cmp tmp_ tmp2 ' -- cgit 2.12.1