diff options
author | David Michael Barr <b@rr-dav.id.au> | 2012-11-30 06:33:30 +0400 |
---|---|---|
committer | David Michael Barr <b@rr-dav.id.au> | 2012-12-03 03:39:17 +0400 |
commit | 44f9f547972efecd326fbf6e92ae1297cc9e1813 (patch) | |
tree | e38c22b3d902f7aa9614db82dd4962f713cdc837 /src/pack.h | |
parent | d1b6ea8ad14f41b87026ab407005e887c4ff6b68 (diff) |
pack: add git_packfile_resolve_header
To paraphrase @peff:
You can get both size and type from a packed object reasonably cheaply.
If you have:
* An object that is not a delta; both type and size are available in the
packfile header.
* An object that is a delta. The packfile type will be OBJ_*_DELTA, and
you have to resolve back to the base to find the real type. That means
potentially a lot of packfile index lookups, but each one is
relatively cheap. For the size, you inflate the first few bytes of the
delta, whose header will tell you the resulting size of applying the
delta to the base.
For simplicity, we just decompress the whole delta for now.
Diffstat (limited to 'src/pack.h')
-rw-r--r-- | src/pack.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pack.h b/src/pack.h index 9fb26b6a9..c1277fdfb 100644 --- a/src/pack.h +++ b/src/pack.h @@ -83,6 +83,12 @@ int git_packfile_unpack_header( git_mwindow **w_curs, git_off_t *curpos); +int git_packfile_resolve_header( + size_t *size_p, + git_otype *type_p, + struct git_pack_file *p, + git_off_t offset); + int git_packfile_unpack(git_rawobj *obj, struct git_pack_file *p, git_off_t *obj_offset); int packfile_unpack_compressed( git_rawobj *obj, |