From: Junio C Hamano Date: Fri, 20 Mar 2015 20:11:51 +0000 (-0700) Subject: Merge branch 'mg/verify-commit' X-Git-Tag: v2.4.0-rc0~32 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/4c24385e80b333695470d3f4fdc28918a2d3108a?ds=inline;hp=-c Merge branch 'mg/verify-commit' Workarounds for certain build of GPG that triggered false breakage in a test. * mg/verify-commit: t7510: do not fail when gpg warns about insecure memory --- 4c24385e80b333695470d3f4fdc28918a2d3108a diff --combined t/t7510-signed-commit.sh index 474dab381a,c24d38248a..3cef18cfda --- a/t/t7510-signed-commit.sh +++ b/t/t7510-signed-commit.sh @@@ -43,20 -43,17 +43,20 @@@ test_expect_success GPG 'create signed test_tick && git rebase -f HEAD^^ && git tag sixth-signed HEAD^ && git tag seventh-signed + + echo 8 >file && test_tick && git commit -a -m eighth -SB7227189 && + git tag eighth-signed-alt ' test_expect_success GPG 'verify and show signatures' ' ( - for commit in initial second merge fourth-signed fifth-signed sixth-signed master + for commit in initial second merge fourth-signed fifth-signed sixth-signed seventh-signed do git verify-commit $commit && git show --pretty=short --show-signature $commit >actual && grep "Good signature from" actual && - ! grep "BAD signature from" actual || exit 1 - echo $commit OK + ! grep "BAD signature from" actual && + echo $commit OK || exit 1 done ) && ( @@@ -65,18 -62,8 +65,18 @@@ test_must_fail git verify-commit $commit && git show --pretty=short --show-signature $commit >actual && ! grep "Good signature from" actual && - ! grep "BAD signature from" actual || exit 1 - echo $commit OK + ! grep "BAD signature from" actual && + echo $commit OK || exit 1 + done + ) && + ( + for commit in eighth-signed-alt + do + git show --pretty=short --show-signature $commit >actual && + grep "Good signature from" actual && + ! grep "BAD signature from" actual && + grep "not certified" actual && + echo $commit OK || exit 1 done ) ' @@@ -86,8 -73,8 +86,8 @@@ test_expect_success GPG 'show signed co git show -s --show-signature initial >show && git verify-commit -v initial >verify.1 2>verify.2 && git cat-file commit initial >cat && - grep -v "gpg: " show >show.commit && - grep "gpg: " show >show.gpg && + grep -v -e "gpg: " -e "Warning: " show >show.commit && + grep -e "gpg: " -e "Warning: " show >show.gpg && grep -v "^ " cat | grep -v "^gpgsig " >cat.commit && test_cmp show.commit commit && test_cmp show.gpg verify.2 && @@@ -95,7 -82,7 +95,7 @@@ ' test_expect_success GPG 'detect fudged signature' ' - git cat-file commit master >raw && + git cat-file commit seventh-signed >raw && sed -e "s/seventh/7th forged/" raw >forged1 && git hash-object -w -t commit forged1 >forged1.commit && @@@ -106,7 -93,7 +106,7 @@@ ' test_expect_success GPG 'detect fudged signature with NUL' ' - git cat-file commit master >raw && + git cat-file commit seventh-signed >raw && cat raw >forged2 && echo Qwik | tr "Q" "\000" >>forged2 && git hash-object -w -t commit forged2 >forged2.commit && @@@ -125,44 -112,4 +125,44 @@@ test_expect_success GPG 'amending alrea ! grep "BAD signature from" actual ' +test_expect_success GPG 'show good signature with custom format' ' + cat >expect <<-\EOF && + G + 13B6F51ECDDE430D + C O Mitter + EOF + git log -1 --format="%G?%n%GK%n%GS" sixth-signed >actual && + test_cmp expect actual +' + +test_expect_success GPG 'show bad signature with custom format' ' + cat >expect <<-\EOF && + B + 13B6F51ECDDE430D + C O Mitter + EOF + git log -1 --format="%G?%n%GK%n%GS" $(cat forged1.commit) >actual && + test_cmp expect actual +' + +test_expect_success GPG 'show unknown signature with custom format' ' + cat >expect <<-\EOF && + U + 61092E85B7227189 + Eris Discordia + EOF + git log -1 --format="%G?%n%GK%n%GS" eighth-signed-alt >actual && + test_cmp expect actual +' + +test_expect_success GPG 'show lack of signature with custom format' ' + cat >expect <<-\EOF && + N + + + EOF + git log -1 --format="%G?%n%GK%n%GS" seventh-unsigned >actual && + test_cmp expect actual +' + test_done