summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c8525c3)
raw | patch | inline | side by side (parent: c8525c3)
author | Michael J Gruber <git@drmicha.warpmail.net> | |
Wed, 10 Nov 2010 11:17:27 +0000 (12:17 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 10 Nov 2010 17:39:56 +0000 (09:39 -0800) |
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>
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/verify-tag.c | patch | blob | history | |
tag.c | patch | blob | history | |
tag.h | patch | blob | history |
diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c
index 9f482c29f516bde84023f401b28b133c1e605333..86cac6d715dbc29b3586e84ea28f4083ddb2a1b8 100644 (file)
--- a/builtin/verify-tag.c
+++ b/builtin/verify-tag.c
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;
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);
index 28641cf85a0d32357269129f0e8b92bb9e21f399..d4f3080e3f8c3d8026292a2eeccc17152b404254 100644 (file)
--- a/tag.c
+++ b/tag.c
#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)
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;
+}
index 47662724a6d7d07eeeacd5c8528d94d750ecf878..85223700396f5ddb00c046a1a9fdb63c92aae40e 100644 (file)
--- a/tag.h
+++ b/tag.h
extern int parse_tag_buffer(struct tag *item, void *data, unsigned long size);
extern int parse_tag(struct tag *item);
extern struct object *deref_tag(struct object *, const char *, int);
+extern size_t parse_signature(const char *buf, unsigned long size);
#endif /* TAG_H */