summaryrefslogtreecommitdiff
path: root/builtin/tag.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-12-08 19:24:13 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-12-08 19:24:13 (GMT)
commita5066a0b07deb76327e3e3ea845afc899e256c51 (patch)
treea3107af36d1982864c3e5d80fb6f7086ba9dd682 /builtin/tag.c
parent657072f3ac5519f146a947253c9959909b38c293 (diff)
parent3d5854e765dedfaf2a942e8fa1e950a40f9dcee3 (diff)
downloadgit-a5066a0b07deb76327e3e3ea845afc899e256c51.zip
git-a5066a0b07deb76327e3e3ea845afc899e256c51.tar.gz
git-a5066a0b07deb76327e3e3ea845afc899e256c51.tar.bz2
Merge branch 'mg/maint-tag-rfc1991'
* mg/maint-tag-rfc1991: tag: recognize rfc1991 signatures tag: factor out sig detection for tag display tag: factor out sig detection for body edits verify-tag: factor out signature detection t/t7004-tag: test handling of rfc1991 signatures
Diffstat (limited to 'builtin/tag.c')
-rw-r--r--builtin/tag.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/builtin/tag.c b/builtin/tag.c
index d1d7d87..aa1f87d 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -29,8 +29,6 @@ struct tag_filter {
struct commit_list *with_commit;
};
-#define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
-
static int show_reference(const char *refname, const unsigned char *sha1,
int flag, void *cb_data)
{
@@ -70,9 +68,9 @@ static int show_reference(const char *refname, const unsigned char *sha1,
return 0;
}
/* only take up to "lines" lines, and strip the signature */
+ size = parse_signature(buf, size);
for (i = 0, sp += 2;
- i < filter->lines && sp < buf + size &&
- prefixcmp(sp, PGP_SIGNATURE "\n");
+ i < filter->lines && sp < buf + size;
i++) {
if (i)
printf("\n ");
@@ -242,8 +240,7 @@ static void write_tag_body(int fd, const unsigned char *sha1)
{
unsigned long size;
enum object_type type;
- char *buf, *sp, *eob;
- size_t len;
+ char *buf, *sp;
buf = read_sha1_file(sha1, &type, &size);
if (!buf)
@@ -256,12 +253,7 @@ static void write_tag_body(int fd, const unsigned char *sha1)
return;
}
sp += 2; /* skip the 2 LFs */
- eob = strstr(sp, "\n" PGP_SIGNATURE "\n");
- if (eob)
- len = eob - sp;
- else
- len = buf + size - sp;
- write_or_die(fd, sp, len);
+ write_or_die(fd, sp, parse_signature(sp, buf + size - sp));
free(buf);
}