From 1b22b6c897efa8aec6eeb51f72a73d507d5e336f Mon Sep 17 00:00:00 2001 From: Michael Lukashov Date: Tue, 16 Feb 2010 23:42:54 +0000 Subject: refactor duplicated encode_header in pack-objects and fast-import The following function is duplicated: encode_header Move this function to sha1_file.c and rename it 'encode_in_pack_object_header', as suggested by Junio C Hamano Signed-off-by: Michael Lukashov Signed-off-by: Junio C Hamano --- cache.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cache.h') diff --git a/cache.h b/cache.h index d478eff1f3..2654b608ba 100644 --- a/cache.h +++ b/cache.h @@ -911,6 +911,14 @@ extern void *unpack_entry(struct packed_git *, off_t, enum object_type *, unsign extern unsigned long unpack_object_header_buffer(const unsigned char *buf, unsigned long len, enum object_type *type, unsigned long *sizep); extern unsigned long get_size_from_delta(struct packed_git *, struct pack_window **, off_t); extern const char *packed_object_info_detail(struct packed_git *, off_t, unsigned long *, unsigned long *, unsigned int *, unsigned char *); +/* + * The per-object header is a pretty dense thing, which is + * - first byte: low four bits are "size", then three bits of "type", + * and the high bit is "size continues". + * - each byte afterwards: low seven bits are size continuation, + * with the high bit being "size continues" + */ +int encode_in_pack_object_header(enum object_type type, uintmax_t size, unsigned char *hdr); /* Dumb servers support */ extern int update_server_info(int); -- cgit v1.3-5-g9baa