Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-10-03 18:54:25 +0400
committerCarlos Martín Nieto <cmn@dwim.me>2013-10-04 12:18:20 +0400
commit51e82492ef5206767e176952733914275d0e3bdc (patch)
tree44ed00901ac72d8cb9d92dc27d90b06f576b55a6 /src/pack-objects.c
parentcf0582b43ce591e7923637d2c8925028aaa5977b (diff)
pack: move the object header function here
Diffstat (limited to 'src/pack-objects.c')
-rw-r--r--src/pack-objects.c36
1 files changed, 1 insertions, 35 deletions
diff --git a/src/pack-objects.c b/src/pack-objects.c
index 2a2f36223..4d79ad95b 100644
--- a/src/pack-objects.c
+++ b/src/pack-objects.c
@@ -228,40 +228,6 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
return 0;
}
-/*
- * The per-object header is a pretty dense thing, which is
- * - first byte: low four bits are "size",
- * then three bits of "type",
- * with the high bit being "size continues".
- * - each byte afterwards: low seven bits are size continuation,
- * with the high bit being "size continues"
- */
-static int gen_pack_object_header(
- unsigned char *hdr,
- unsigned long size,
- git_otype type)
-{
- unsigned char *hdr_base;
- unsigned char c;
-
- assert(type >= GIT_OBJ_COMMIT && type <= GIT_OBJ_REF_DELTA);
-
- /* TODO: add support for chunked objects; see git.git 6c0d19b1 */
-
- c = (unsigned char)((type << 4) | (size & 15));
- size >>= 4;
- hdr_base = hdr;
-
- while (size) {
- *hdr++ = c | 0x80;
- c = size & 0x7f;
- size >>= 7;
- }
- *hdr++ = c;
-
- return (int)(hdr - hdr_base);
-}
-
static int get_delta(void **out, git_odb *odb, git_pobject *po)
{
git_odb_object *src = NULL, *trg = NULL;
@@ -323,7 +289,7 @@ static int write_object(git_buf *buf, git_packbuilder *pb, git_pobject *po)
}
/* Write header */
- hdr_len = gen_pack_object_header(hdr, size, type);
+ hdr_len = git_packfile__object_header(hdr, size, type);
if (git_buf_put(buf, (char *)hdr, hdr_len) < 0)
goto on_error;