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>
This commit is contained in:

committed by
Junio C Hamano

parent
81536b2dfa
commit
3d5854e765
@ -1048,19 +1048,19 @@ cp "$1" actual
|
|||||||
EOF
|
EOF
|
||||||
chmod +x fakeeditor
|
chmod +x fakeeditor
|
||||||
|
|
||||||
test_expect_failure GPG \
|
test_expect_success GPG \
|
||||||
'reediting a signed tag body omits signature' '
|
'reediting a signed tag body omits signature' '
|
||||||
echo "RFC1991 signed tag" >expect &&
|
echo "RFC1991 signed tag" >expect &&
|
||||||
GIT_EDITOR=./fakeeditor git tag -f -s rfc1991-signed-tag $commit &&
|
GIT_EDITOR=./fakeeditor git tag -f -s rfc1991-signed-tag $commit &&
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_failure GPG \
|
test_expect_success GPG \
|
||||||
'verifying rfc1991 signature' '
|
'verifying rfc1991 signature' '
|
||||||
git tag -v rfc1991-signed-tag
|
git tag -v rfc1991-signed-tag
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_failure GPG \
|
test_expect_success GPG \
|
||||||
'list tag with rfc1991 signature' '
|
'list tag with rfc1991 signature' '
|
||||||
echo "rfc1991-signed-tag RFC1991 signed tag" >expect &&
|
echo "rfc1991-signed-tag RFC1991 signed tag" >expect &&
|
||||||
git tag -l -n1 rfc1991-signed-tag >actual &&
|
git tag -l -n1 rfc1991-signed-tag >actual &&
|
||||||
@ -1073,12 +1073,12 @@ test_expect_failure GPG \
|
|||||||
|
|
||||||
rm -f gpghome/gpg.conf
|
rm -f gpghome/gpg.conf
|
||||||
|
|
||||||
test_expect_failure GPG \
|
test_expect_success GPG \
|
||||||
'verifying rfc1991 signature without --rfc1991' '
|
'verifying rfc1991 signature without --rfc1991' '
|
||||||
git tag -v rfc1991-signed-tag
|
git tag -v rfc1991-signed-tag
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_failure GPG \
|
test_expect_success GPG \
|
||||||
'list tag with rfc1991 signature without --rfc1991' '
|
'list tag with rfc1991 signature without --rfc1991' '
|
||||||
echo "rfc1991-signed-tag RFC1991 signed tag" >expect &&
|
echo "rfc1991-signed-tag RFC1991 signed tag" >expect &&
|
||||||
git tag -l -n1 rfc1991-signed-tag >actual &&
|
git tag -l -n1 rfc1991-signed-tag >actual &&
|
||||||
@ -1089,7 +1089,7 @@ test_expect_failure GPG \
|
|||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_failure GPG \
|
test_expect_success GPG \
|
||||||
'reediting a signed tag body omits signature' '
|
'reediting a signed tag body omits signature' '
|
||||||
echo "RFC1991 signed tag" >expect &&
|
echo "RFC1991 signed tag" >expect &&
|
||||||
GIT_EDITOR=./fakeeditor git tag -f -s rfc1991-signed-tag $commit &&
|
GIT_EDITOR=./fakeeditor git tag -f -s rfc1991-signed-tag $commit &&
|
||||||
|
4
tag.c
4
tag.c
@ -5,6 +5,7 @@
|
|||||||
#include "blob.h"
|
#include "blob.h"
|
||||||
|
|
||||||
#define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
|
#define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
|
||||||
|
#define PGP_MESSAGE "-----BEGIN PGP MESSAGE-----"
|
||||||
|
|
||||||
const char *tag_type = "tag";
|
const char *tag_type = "tag";
|
||||||
|
|
||||||
@ -140,7 +141,8 @@ size_t parse_signature(const char *buf, unsigned long size)
|
|||||||
{
|
{
|
||||||
char *eol;
|
char *eol;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
while (len < size && prefixcmp(buf + len, PGP_SIGNATURE)) {
|
while (len < size && prefixcmp(buf + len, PGP_SIGNATURE) &&
|
||||||
|
prefixcmp(buf + len, PGP_MESSAGE)) {
|
||||||
eol = memchr(buf + len, '\n', size - len);
|
eol = memchr(buf + len, '\n', size - len);
|
||||||
len += eol ? eol - (buf + len) + 1 : size - len;
|
len += eol ? eol - (buf + len) + 1 : size - len;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user