tag: recognize rfc1991 signatures
We have always been creating rfc1991 signatures for users with "rfc1991" in their gpg config but failed to recognize them (tag -l -n largenumber) and verify them (tag -v, verify-tag). Make good use of the refactored signature detection and let us recognize and verify those signatures also. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael J Gruber committed
Nov 10, 2010 at 12:17 UTC
3d5854e765dedfaf2a942e8fa1e950a40f9dcee3
2 files changed
+9
-7
t/t7004-tag.sh
+6
-6
@@ -1048,19 +1048,19 @@ cp "$1" actual
1048
EOF
1049
chmod +x fakeeditor
1050
1051
-test_expect_failure GPG \
1051
+test_expect_success GPG \
1052
'reediting a signed tag body omits signature' '
1053
echo "RFC1991 signed tag" >expect &&
1054
GIT_EDITOR=./fakeeditor git tag -f -s rfc1991-signed-tag $commit &&
1055
test_cmp expect actual
1056
'
1057
1058
-test_expect_failure GPG \
1058
+test_expect_success GPG \
1059
'verifying rfc1991 signature' '
1060
git tag -v rfc1991-signed-tag
1061
'
1062
1063
-test_expect_failure GPG \
1063
+test_expect_success GPG \
1064
'list tag with rfc1991 signature' '
1065
echo "rfc1991-signed-tag RFC1991 signed tag" >expect &&
1066
git tag -l -n1 rfc1991-signed-tag >actual &&
@@ -1073,12 +1073,12 @@ test_expect_failure GPG \
1073
1074
rm -f gpghome/gpg.conf
1075
1076
-test_expect_failure GPG \
1076
+test_expect_success GPG \
1077
'verifying rfc1991 signature without --rfc1991' '
1078
git tag -v rfc1991-signed-tag
1079
'
1080
1081
-test_expect_failure GPG \
1081
+test_expect_success GPG \
1082
'list tag with rfc1991 signature without --rfc1991' '
1083
echo "rfc1991-signed-tag RFC1991 signed tag" >expect &&
1084
git tag -l -n1 rfc1991-signed-tag >actual &&
@@ -1089,7 +1089,7 @@ test_expect_failure GPG \
1089
test_cmp expect actual
1090
'
1091
1092
-test_expect_failure GPG \
1092
+test_expect_success GPG \
1093
'reediting a signed tag body omits signature' '
1094
echo "RFC1991 signed tag" >expect &&
1095
GIT_EDITOR=./fakeeditor git tag -f -s rfc1991-signed-tag $commit &&
tag.c
+3
-1
@@ -5,6 +5,7 @@
5
#include "blob.h"
6
7
#define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
8
+#define PGP_MESSAGE "-----BEGIN PGP MESSAGE-----"
9
10
const char *tag_type = "tag";
11
@@ -140,7 +141,8 @@ size_t parse_signature(const char *buf, unsigned long size)
141
{
142
char *eol;
143
size_t len = 0;
143
- while (len < size && prefixcmp(buf + len, PGP_SIGNATURE)) {
144
+ while (len < size && prefixcmp(buf + len, PGP_SIGNATURE) &&
145
+ prefixcmp(buf + len, PGP_MESSAGE)) {
146
eol = memchr(buf + len, '\n', size - len);
147
len += eol ? eol - (buf + len) + 1 : size - len;
148
}