summaryrefslogtreecommitdiff
path: root/tag.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-08-19 20:18:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-09-15 20:23:20 (GMT)
commitd7c67668fe10184736bdfe953ed8dcbfdb57e0c2 (patch)
treef155fb3d22e7489047a661f16bf22a6da708d6cc /tag.c
parenta50e7ca3215492b16d96221cf762dbe71ed99722 (diff)
downloadgit-d7c67668fe10184736bdfe953ed8dcbfdb57e0c2.zip
git-d7c67668fe10184736bdfe953ed8dcbfdb57e0c2.tar.gz
git-d7c67668fe10184736bdfe953ed8dcbfdb57e0c2.tar.bz2
gpg-interface: move parse_signature() to where it should be
Our signed-tag objects set the standard format used by Git to store GPG-signed payload (i.e. the payload followed by its detached signature) [*1*], and it made sense to have a helper to find the boundary between the payload and its signature in tag.c back then. Newer code added later to parse other kinds of objects that learned to use the same format to store GPG-signed payload (e.g. signed commits), however, kept using the helper from the same location. Move it to gpg-interface; the helper is no longer about signed tag, but it is how our code and data interact with GPG. [Reference] *1* http://thread.gmane.org/gmane.linux.kernel/297998/focus=1383 Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'tag.c')
-rw-r--r--tag.c20
1 files changed, 0 insertions, 20 deletions
diff --git a/tag.c b/tag.c
index 82d841b..5b0ac62 100644
--- a/tag.c
+++ b/tag.c
@@ -4,9 +4,6 @@
#include "tree.h"
#include "blob.h"
-#define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
-#define PGP_MESSAGE "-----BEGIN PGP MESSAGE-----"
-
const char *tag_type = "tag";
struct object *deref_tag(struct object *o, const char *warn, int warnlen)
@@ -143,20 +140,3 @@ int parse_tag(struct tag *item)
free(data);
return ret;
}
-
-/*
- * Look at a signed tag object, and return the offset where
- * the embedded detached signature begins, or the end of the
- * data when there is no such signature.
- */
-size_t parse_signature(const char *buf, unsigned long size)
-{
- char *eol;
- size_t len = 0;
- while (len < size && !starts_with(buf + len, PGP_SIGNATURE) &&
- !starts_with(buf + len, PGP_MESSAGE)) {
- eol = memchr(buf + len, '\n', size - len);
- len += eol ? eol - (buf + len) + 1 : size - len;
- }
- return len;
-}