summaryrefslogtreecommitdiff
path: root/builtin/tag.c
diff options
context:
space:
mode:
authorMichael J Gruber <git@drmicha.warpmail.net>2010-11-10 11:17:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-11-10 17:40:18 (GMT)
commite10dfb62ee21a3970ccfe44f30f97fcd6457bb78 (patch)
tree3303e2eb9f6c6091abd957737381b2e7f89d8ea8 /builtin/tag.c
parentac58c4c795455addd0d8f007e969d56e43f1165b (diff)
downloadgit-e10dfb62ee21a3970ccfe44f30f97fcd6457bb78.zip
git-e10dfb62ee21a3970ccfe44f30f97fcd6457bb78.tar.gz
git-e10dfb62ee21a3970ccfe44f30f97fcd6457bb78.tar.bz2
tag: factor out sig detection for body edits
Use the factored out code for sig detection when editing existing tag bodies (tag -a -f without -m). Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/tag.c')
-rw-r--r--builtin/tag.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/builtin/tag.c b/builtin/tag.c
index d311491..66feeb0 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)
{
@@ -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);
}