t7510: check %G* pretty-format output
We do not check these along with the other pretty-format placeholders in t6006, because we need signed commits to make them interesting. t7510 has such commits, and can easily exercise them in addition to the regular --show-signature code path. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Jun 16, 2014 at 20:06 UTC
06ca0f45a063f7186cce96a58a5fb6bef16ec204
1 file changed
+40
t/t7510-signed-commit.sh
+40
@@ -107,4 +107,44 @@ test_expect_success GPG 'amending already signed commit' '
107
! grep "BAD signature from" actual
108
'
109
110
+test_expect_success GPG 'show good signature with custom format' '
111
+ cat >expect <<-\EOF &&
112
+ G
113
+ 13B6F51ECDDE430D
114
+ C O Mitter <committer@example.com>
115
+ EOF
116
+ git log -1 --format="%G?%n%GK%n%GS" sixth-signed >actual &&
117
+ test_cmp expect actual
118
+'
119
+
120
+test_expect_success GPG 'show bad signature with custom format' '
121
+ cat >expect <<-\EOF &&
122
+ B
123
+ 13B6F51ECDDE430D
124
+ C O Mitter <committer@example.com>
125
+ EOF
126
+ git log -1 --format="%G?%n%GK%n%GS" $(cat forged1.commit) >actual &&
127
+ test_cmp expect actual
128
+'
129
+
130
+test_expect_success GPG 'show unknown signature with custom format' '
131
+ cat >expect <<-\EOF &&
132
+ U
133
+ 61092E85B7227189
134
+ Eris Discordia <discord@example.net>
135
+ EOF
136
+ git log -1 --format="%G?%n%GK%n%GS" eighth-signed-alt >actual &&
137
+ test_cmp expect actual
138
+'
139
+
140
+test_expect_success GPG 'show lack of signature with custom format' '
141
+ cat >expect <<-\EOF &&
142
+ N
143
+
144
+
145
+ EOF
146
+ git log -1 --format="%G?%n%GK%n%GS" seventh-unsigned >actual &&
147
+ test_cmp expect actual
148
+'
149
+
150
test_done