File tree Expand file tree Collapse file tree 4 files changed +6
-7
lines changed Expand file tree Collapse file tree 4 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ test_expect_success GPG 'create repositories with signed commits' '
2929 echo 4 >d && git add d &&
3030 test_tick && git commit -S -m "bad" &&
3131 git cat-file commit HEAD >raw &&
32- sed -e "s/bad/forged bad/" raw >forged &&
32+ sed -e "s/^ bad/forged bad/" raw >forged &&
3333 git hash-object -w -t commit forged >forged.commit &&
3434 git checkout $(cat forged.commit)
3535 ) &&
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ test_expect_success GPG 'verify and show signatures' '
7474
7575test_expect_success GPG ' detect fudged signature' '
7676 git cat-file tag seventh-signed >raw &&
77- sed -e "s/seventh/7th forged/" raw >forged1 &&
77+ sed -e "/^tag / s/seventh/7th forged/" raw >forged1 &&
7878 git hash-object -w -t tag forged1 >forged1.tag &&
7979 test_must_fail git verify-tag $(cat forged1.tag) 2>actual1 &&
8080 grep "BAD signature from" actual1 &&
Original file line number Diff line number Diff line change @@ -142,10 +142,9 @@ test_expect_success GPG 'show signed commit with signature' '
142142
143143test_expect_success GPG ' detect fudged signature' '
144144 git cat-file commit seventh-signed >raw &&
145-
146- sed -e "s/seventh/7th forged/" raw >forged1 &&
145+ sed -e "s/^seventh/7th forged/" raw >forged1 &&
147146 git hash-object -w -t commit forged1 >forged1.commit &&
148- ! git verify-commit $(cat forged1.commit) &&
147+ test_must_fail git verify-commit $(cat forged1.commit) &&
149148 git show --pretty=short --show-signature $(cat forged1.commit) >actual1 &&
150149 grep "BAD signature from" actual1 &&
151150 ! grep "Good signature from" actual1
@@ -156,7 +155,7 @@ test_expect_success GPG 'detect fudged signature with NUL' '
156155 cat raw >forged2 &&
157156 echo Qwik | tr "Q" "\000" >>forged2 &&
158157 git hash-object -w -t commit forged2 >forged2.commit &&
159- ! git verify-commit $(cat forged2.commit) &&
158+ test_must_fail git verify-commit $(cat forged2.commit) &&
160159 git show --pretty=short --show-signature $(cat forged2.commit) >actual2 &&
161160 grep "BAD signature from" actual2 &&
162161 ! grep "Good signature from" actual2
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ test_expect_success GPG 'create signed commits' '
2323 echo 3 >bar && git add bar &&
2424 test_tick && git commit -S -m "bad on side" &&
2525 git cat-file commit side-bad >raw &&
26- sed -e "s/bad/forged bad/" raw >forged &&
26+ sed -e "s/^ bad/forged bad/" raw >forged &&
2727 git hash-object -w -t commit forged >forged.commit &&
2828 git checkout initial &&
2929
You can’t perform that action at this time.
0 commit comments