aboutsummaryrefslogtreecommitdiff
path: root/tag.c
diff options
context:
space:
mode:
authorMichael J Gruber <git@drmicha.warpmail.net>2010-11-10 12:17:27 +0100
committerJunio C Hamano <gitster@pobox.com>2010-11-10 09:39:56 -0800
commitac58c4c795455addd0d8f007e969d56e43f1165b (patch)
tree974dbf4bb055f6842af9b363af559eaa16239933 /tag.c
parentc8525c302bfd8c5bc6a7e2f7aec0be2951eefd90 (diff)
downloadgit-ac58c4c795455addd0d8f007e969d56e43f1165b.tar.gz
git-ac58c4c795455addd0d8f007e969d56e43f1165b.tar.xz
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 'tag.c')
-rw-r--r--tag.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tag.c b/tag.c
index 28641cf85..d4f3080e3 100644
--- a/tag.c
+++ b/tag.c
@@ -4,6 +4,8 @@
#include "tree.h"
#include "blob.h"
+#define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
+
const char *tag_type = "tag";
struct object *deref_tag(struct object *o, const char *warn, int warnlen)
@@ -133,3 +135,14 @@ int parse_tag(struct tag *item)
free(data);
return ret;
}
+
+size_t parse_signature(const char *buf, unsigned long size)
+{
+ char *eol;
+ size_t 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;
+ }
+ return len;
+}