1607
grep "^| | gpg: Good signature" actual
1608
'
1609
1610
+test_expect_success GPG 'log --graph --show-signature for merged tag with missing key' '
1611
+ test_when_finished "git reset --hard && git checkout master" &&
1612
+ git checkout -b plain-nokey master &&
1613
+ echo aaa >bar &&
1614
+ git add bar &&
1615
+ git commit -m bar_commit &&
1616
+ git checkout -b tagged-nokey master &&
1617
+ echo bbb >baz &&
1618
+ git add baz &&
1619
+ git commit -m baz_commit &&
1620
+ git tag -s -m signed_tag_msg signed_tag_nokey &&
1621
+ git checkout plain-nokey &&
1622
+ git merge --no-ff -m msg signed_tag_nokey &&
1623
+ GNUPGHOME=. git log --graph --show-signature -n1 plain-nokey >actual &&
1624
+ grep "^|\\\ merged tag" actual &&
1625
+ grep "^| | gpg: Signature made" actual &&
1626
+ grep "^| | gpg: Can'"'"'t check signature: \(public key not found\|No public key\)" actual
1627
+'
1628
+
1629
+test_expect_success GPG 'log --graph --show-signature for merged tag with bad signature' '
1630
+ test_when_finished "git reset --hard && git checkout master" &&
1631
+ git checkout -b plain-bad master &&
1632
+ echo aaa >bar &&
1633
+ git add bar &&
1634
+ git commit -m bar_commit &&
1635
+ git checkout -b tagged-bad master &&
1636
+ echo bbb >baz &&
1637
+ git add baz &&
1638
+ git commit -m baz_commit &&
1639
+ git tag -s -m signed_tag_msg signed_tag_bad &&
1640
+ git cat-file tag signed_tag_bad >raw &&
1641
+ sed -e "s/signed_tag_msg/forged/" raw >forged &&
1642
+ git hash-object -w -t tag forged >forged.tag &&
1643
+ git checkout plain-bad &&
1644
+ git merge --no-ff -m msg "$(cat forged.tag)" &&
1645
+ git log --graph --show-signature -n1 plain-bad >actual &&
1646
+ grep "^|\\\ merged tag" actual &&
1647
+ grep "^| | gpg: Signature made" actual &&
1648
+ grep "^| | gpg: BAD signature from" actual
1649
+'
1650
+
1651
+test_expect_success GPG 'log --show-signature for merged tag with GPG failure' '
1652
+ test_when_finished "git reset --hard && git checkout master" &&
1653
+ git checkout -b plain-fail master &&
1654
+ echo aaa >bar &&
1655
+ git add bar &&
1656
+ git commit -m bar_commit &&
1657
+ git checkout -b tagged-fail master &&
1658
+ echo bbb >baz &&
1659
+ git add baz &&
1660
+ git commit -m baz_commit &&
1661
+ git tag -s -m signed_tag_msg signed_tag_fail &&
1662
+ git checkout plain-fail &&
1663
+ git merge --no-ff -m msg signed_tag_fail &&
1664
+ TMPDIR="$(pwd)/bogus" git log --show-signature -n1 plain-fail >actual &&
1665
+ grep "^merged tag" actual &&
1666
+ grep "^No signature" actual &&
1667
+ ! grep "^gpg: Signature made" actual
1668
+'
1669
+
1670
test_expect_success GPGSM 'log --graph --show-signature for merged tag x509' '
1671
test_when_finished "git reset --hard && git checkout master" &&
1672
test_config gpg.format x509 &&
1688
grep "^| | gpgsm: Good signature" actual
1689
'
1690
1691
+test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 missing key' '
1692
+ test_when_finished "git reset --hard && git checkout master" &&
1693
+ test_config gpg.format x509 &&
1694
+ test_config user.signingkey $GIT_COMMITTER_EMAIL &&
1695
+ git checkout -b plain-x509-nokey master &&
1696
+ echo aaa >bar &&
1697
+ git add bar &&
1698
+ git commit -m bar_commit &&
1699
+ git checkout -b tagged-x509-nokey master &&
1700
+ echo bbb >baz &&
1701
+ git add baz &&
1702
+ git commit -m baz_commit &&
1703
+ git tag -s -m signed_tag_msg signed_tag_x509_nokey &&
1704
+ git checkout plain-x509-nokey &&
1705
+ git merge --no-ff -m msg signed_tag_x509_nokey &&
1706
+ GNUPGHOME=. git log --graph --show-signature -n1 plain-x509-nokey >actual &&
1707
+ grep "^|\\\ merged tag" actual &&
1708
+ grep "^| | gpgsm: certificate not found" actual
1709
+'
1710
+
1711
+test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 bad signature' '
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-bad master &&
1716
+ echo aaa >bar &&
1717
+ git add bar &&
1718
+ git commit -m bar_commit &&
1719
+ git checkout -b tagged-x509-bad 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_bad &&
1724
+ git cat-file tag signed_tag_x509_bad >raw &&
1725
+ sed -e "s/signed_tag_msg/forged/" raw >forged &&
1726
+ git hash-object -w -t tag forged >forged.tag &&
1727
+ git checkout plain-x509-bad &&
1728
+ git merge --no-ff -m msg "$(cat forged.tag)" &&
1729
+ git log --graph --show-signature -n1 plain-x509-bad >actual &&
1730
+ grep "^|\\\ merged tag" actual &&
1731
+ grep "^| | gpgsm: Signature made" actual &&
1732
+ grep "^| | gpgsm: invalid signature" actual
1733
+'
1734
+
1735
+
1736
test_expect_success GPG '--no-show-signature overrides --show-signature' '
1737
git log -1 --show-signature --no-show-signature signed >actual &&
1738
! grep "^gpg:" actual