aboutsummaryrefslogtreecommitdiffstats
path: root/packfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'packfile.c')
-rw-r--r--packfile.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/packfile.c b/packfile.c
index 813584646f..e2bdadc7cb 100644
--- a/packfile.c
+++ b/packfile.c
@@ -2294,3 +2294,20 @@ int is_promisor_object(const struct object_id *oid)
}
return oidset_contains(&promisor_objects, oid);
}
+
+int parse_pack_header_option(const char *in, unsigned char *out, unsigned int *len)
+{
+ struct pack_header *hdr;
+ char *c;
+
+ hdr = (struct pack_header *)out;
+ hdr->hdr_signature = htonl(PACK_SIGNATURE);
+ hdr->hdr_version = htonl(strtoul(in, &c, 10));
+ if (*c != ',')
+ return -1;
+ hdr->hdr_entries = htonl(strtoul(c + 1, &c, 10));
+ if (*c)
+ return -1;
+ *len = sizeof(*hdr);
+ return 0;
+}