@@ -1627,6 +1627,66 @@ test_expect_success GPG 'log --graph --show-signature for merged tag in shallow
16271627 grep "tag signed_tag_shallow names a non-parent $hash" actual
16281628'
16291629
1630+ test_expect_success GPG ' log --graph --show-signature for merged tag with missing key' '
1631+ test_when_finished "git reset --hard && git checkout master" &&
1632+ git checkout -b plain-nokey master &&
1633+ echo aaa >bar &&
1634+ git add bar &&
1635+ git commit -m bar_commit &&
1636+ git checkout -b tagged-nokey master &&
1637+ echo bbb >baz &&
1638+ git add baz &&
1639+ git commit -m baz_commit &&
1640+ git tag -s -m signed_tag_msg signed_tag_nokey &&
1641+ git checkout plain-nokey &&
1642+ git merge --no-ff -m msg signed_tag_nokey &&
1643+ GNUPGHOME=. git log --graph --show-signature -n1 plain-nokey >actual &&
1644+ grep "^|\\\ merged tag" actual &&
1645+ grep "^| | gpg: Signature made" actual &&
1646+ grep "^| | gpg: Can' " '" ' t check signature: \(public key not found\|No public key\)" actual
1647+ '
1648+
1649+ test_expect_success GPG ' log --graph --show-signature for merged tag with bad signature' '
1650+ test_when_finished "git reset --hard && git checkout master" &&
1651+ git checkout -b plain-bad master &&
1652+ echo aaa >bar &&
1653+ git add bar &&
1654+ git commit -m bar_commit &&
1655+ git checkout -b tagged-bad master &&
1656+ echo bbb >baz &&
1657+ git add baz &&
1658+ git commit -m baz_commit &&
1659+ git tag -s -m signed_tag_msg signed_tag_bad &&
1660+ git cat-file tag signed_tag_bad >raw &&
1661+ sed -e "s/signed_tag_msg/forged/" raw >forged &&
1662+ git hash-object -w -t tag forged >forged.tag &&
1663+ git checkout plain-bad &&
1664+ git merge --no-ff -m msg "$(cat forged.tag)" &&
1665+ git log --graph --show-signature -n1 plain-bad >actual &&
1666+ grep "^|\\\ merged tag" actual &&
1667+ grep "^| | gpg: Signature made" actual &&
1668+ grep "^| | gpg: BAD signature from" actual
1669+ '
1670+
1671+ test_expect_success GPG ' log --show-signature for merged tag with GPG failure' '
1672+ test_when_finished "git reset --hard && git checkout master" &&
1673+ git checkout -b plain-fail master &&
1674+ echo aaa >bar &&
1675+ git add bar &&
1676+ git commit -m bar_commit &&
1677+ git checkout -b tagged-fail master &&
1678+ echo bbb >baz &&
1679+ git add baz &&
1680+ git commit -m baz_commit &&
1681+ git tag -s -m signed_tag_msg signed_tag_fail &&
1682+ git checkout plain-fail &&
1683+ git merge --no-ff -m msg signed_tag_fail &&
1684+ TMPDIR="$(pwd)/bogus" git log --show-signature -n1 plain-fail >actual &&
1685+ grep "^merged tag" actual &&
1686+ grep "^No signature" actual &&
1687+ ! grep "^gpg: Signature made" actual
1688+ '
1689+
16301690test_expect_success GPGSM ' log --graph --show-signature for merged tag x509' '
16311691 test_when_finished "git reset --hard && git checkout master" &&
16321692 test_config gpg.format x509 &&
@@ -1648,6 +1708,51 @@ test_expect_success GPGSM 'log --graph --show-signature for merged tag x509' '
16481708 grep "^| | gpgsm: Good signature" actual
16491709'
16501710
1711+ test_expect_success GPGSM ' log --graph --show-signature for merged tag x509 missing key' '
1712+ test_when_finished "git reset --hard && git checkout master" &&
1713+ test_config gpg.format x509 &&
1714+ test_config user.signingkey $GIT_COMMITTER_EMAIL &&
1715+ git checkout -b plain-x509-nokey master &&
1716+ echo aaa >bar &&
1717+ git add bar &&
1718+ git commit -m bar_commit &&
1719+ git checkout -b tagged-x509-nokey master &&
1720+ echo bbb >baz &&
1721+ git add baz &&
1722+ git commit -m baz_commit &&
1723+ git tag -s -m signed_tag_msg signed_tag_x509_nokey &&
1724+ git checkout plain-x509-nokey &&
1725+ git merge --no-ff -m msg signed_tag_x509_nokey &&
1726+ GNUPGHOME=. git log --graph --show-signature -n1 plain-x509-nokey >actual &&
1727+ grep "^|\\\ merged tag" actual &&
1728+ grep "^| | gpgsm: certificate not found" actual
1729+ '
1730+
1731+ test_expect_success GPGSM ' log --graph --show-signature for merged tag x509 bad signature' '
1732+ test_when_finished "git reset --hard && git checkout master" &&
1733+ test_config gpg.format x509 &&
1734+ test_config user.signingkey $GIT_COMMITTER_EMAIL &&
1735+ git checkout -b plain-x509-bad master &&
1736+ echo aaa >bar &&
1737+ git add bar &&
1738+ git commit -m bar_commit &&
1739+ git checkout -b tagged-x509-bad master &&
1740+ echo bbb >baz &&
1741+ git add baz &&
1742+ git commit -m baz_commit &&
1743+ git tag -s -m signed_tag_msg signed_tag_x509_bad &&
1744+ git cat-file tag signed_tag_x509_bad >raw &&
1745+ sed -e "s/signed_tag_msg/forged/" raw >forged &&
1746+ git hash-object -w -t tag forged >forged.tag &&
1747+ git checkout plain-x509-bad &&
1748+ git merge --no-ff -m msg "$(cat forged.tag)" &&
1749+ git log --graph --show-signature -n1 plain-x509-bad >actual &&
1750+ grep "^|\\\ merged tag" actual &&
1751+ grep "^| | gpgsm: Signature made" actual &&
1752+ grep "^| | gpgsm: invalid signature" actual
1753+ '
1754+
1755+
16511756test_expect_success GPG ' --no-show-signature overrides --show-signature' '
16521757 git log -1 --show-signature --no-show-signature signed >actual &&
16531758 ! grep "^gpg:" actual
0 commit comments