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' '
29
29
echo 4 >d && git add d &&
30
30
test_tick && git commit -S -m "bad" &&
31
31
git cat-file commit HEAD >raw &&
32
- sed -e "s/bad/forged bad/" raw >forged &&
32
+ sed -e "s/^ bad/forged bad/" raw >forged &&
33
33
git hash-object -w -t commit forged >forged.commit &&
34
34
git checkout $(cat forged.commit)
35
35
) &&
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ test_expect_success GPG 'verify and show signatures' '
74
74
75
75
test_expect_success GPG ' detect fudged signature' '
76
76
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 &&
78
78
git hash-object -w -t tag forged1 >forged1.tag &&
79
79
test_must_fail git verify-tag $(cat forged1.tag) 2>actual1 &&
80
80
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' '
142
142
143
143
test_expect_success GPG ' detect fudged signature' '
144
144
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 &&
147
146
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) &&
149
148
git show --pretty=short --show-signature $(cat forged1.commit) >actual1 &&
150
149
grep "BAD signature from" actual1 &&
151
150
! grep "Good signature from" actual1
@@ -156,7 +155,7 @@ test_expect_success GPG 'detect fudged signature with NUL' '
156
155
cat raw >forged2 &&
157
156
echo Qwik | tr "Q" "\000" >>forged2 &&
158
157
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) &&
160
159
git show --pretty=short --show-signature $(cat forged2.commit) >actual2 &&
161
160
grep "BAD signature from" actual2 &&
162
161
! 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' '
23
23
echo 3 >bar && git add bar &&
24
24
test_tick && git commit -S -m "bad on side" &&
25
25
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 &&
27
27
git hash-object -w -t commit forged >forged.commit &&
28
28
git checkout initial &&
29
29
You can’t perform that action at this time.
0 commit comments