summaryrefslogtreecommitdiff
path: root/builtin/verify-tag.c
diff options
context:
space:
mode:
authorMichael J Gruber <git@drmicha.warpmail.net>2010-11-10 11:17:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-11-10 17:39:56 (GMT)
commitac58c4c795455addd0d8f007e969d56e43f1165b (patch)
tree974dbf4bb055f6842af9b363af559eaa16239933 /builtin/verify-tag.c
parentc8525c302bfd8c5bc6a7e2f7aec0be2951eefd90 (diff)
downloadgit-ac58c4c795455addd0d8f007e969d56e43f1165b.zip
git-ac58c4c795455addd0d8f007e969d56e43f1165b.tar.gz
git-ac58c4c795455addd0d8f007e969d56e43f1165b.tar.bz2
verify-tag: factor out signature detection
into tag.h/c for later reuse and modification. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/verify-tag.c')
-rw-r--r--builtin/verify-tag.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c
index 9f482c2..86cac6d 100644
--- a/builtin/verify-tag.c
+++ b/builtin/verify-tag.c
@@ -17,13 +17,11 @@ static const char * const verify_tag_usage[] = {
NULL
};
-#define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
-
static int run_gpg_verify(const char *buf, unsigned long size, int verbose)
{
struct child_process gpg;
const char *args_gpg[] = {"gpg", "--verify", "FILE", "-", NULL};
- char path[PATH_MAX], *eol;
+ char path[PATH_MAX];
size_t len;
int fd, ret;
@@ -37,11 +35,7 @@ static int run_gpg_verify(const char *buf, unsigned long size, int verbose)
close(fd);
/* find the length without signature */
- len = 0;
- while (len < size && prefixcmp(buf + len, PGP_SIGNATURE)) {
- eol = memchr(buf + len, '\n', size - len);
- len += eol ? eol - (buf + len) + 1 : size - len;
- }
+ len = parse_signature(buf, size);
if (verbose)
write_in_full(1, buf, len);