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>
This commit is contained in:
committed by
Junio C Hamano
parent
c8525c302b
commit
ac58c4c795
13
tag.c
13
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user