Re: [PATCHv4 4/4] t7510: test verify-commit
On 27. Juni 2014 21:32:30 MESZ, Junio C Hamano <gitster@pobox.com> wrote:
Show 20 quoted lines
>Michael J Gruber <git@drmicha.warpmail.net> writes:
>
>> sed -e "s/seventh/7th forged/" raw >forged1 &&
>> git hash-object -w -t commit forged1 >forged1.commit &&
>> + ! git verify-commit $(cat forged1.commit) &&
>
>test_must_fail git verify-commit ... &&
>
>> git show --pretty=short --show-signature $(cat forged1.commit)
>>actual1 &&
>> grep "BAD signature from" actual1 &&
>> ! grep "Good signature from" actual1
>> @@ -94,6 +110,7 @@ test_expect_success GPG 'detect fudged signature
>with NUL' '
>> cat raw >forged2 &&
>> echo Qwik | tr "Q" "\000" >>forged2 &&
>> git hash-object -w -t commit forged2 >forged2.commit &&
>> + ! git verify-commit $(cat forged2.commit) &&
>
>test_must_fail git verify-commit ... &&
Sorry for missing or mis-rebasing these. I meant to cover them all.
Show 23 quoted lines
>
>> git show --pretty=short --show-signature $(cat forged2.commit)
>>actual2 &&
>> grep "BAD signature from" actual2 &&
>> ! grep "Good signature from" actual2
>> @@ -102,6 +119,7 @@ test_expect_success GPG 'detect fudged signature
>with NUL' '
>> test_expect_success GPG 'amending already signed commit' '
>> git checkout fourth-signed^0 &&
>> git commit --amend -S --no-edit &&
>> + git verify-commit HEAD &&
>> git show -s --show-signature HEAD >actual &&
>> grep "Good signature from" actual &&
>> ! grep "BAD signature from" actual
>
>Most of the tests, unlike "git show --show-signature" tests, do not
>seem to check the output from the command. Is it because its
>primary interface to scripts is its exit status [*1*]?
>
>[Footnote]
>
>*1* "Yes" is totally an acceptable answer and a justification for
>not checking the output in many of these tests.
Yes, the idea was to check the exit status in all cases (the loopy subtests) and the textual output in a few exemplary ones. I didn't want to bloat the test unnecessarily.
Michael