summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorMichael Lukashov <michael.lukashov@gmail.com>2010-02-16 23:42:54 +0000
committerJunio C Hamano <gitster@pobox.com>2010-02-17 15:30:20 -0800
commit1b22b6c897efa8aec6eeb51f72a73d507d5e336f (patch)
tree3c5bbefcdabc6c3f5dff047e78cbe8e6426a93a2 /cache.h
parent44e0f450350661b110c61ea0eff2657f58fe6ad0 (diff)
downloadgit-1b22b6c897efa8aec6eeb51f72a73d507d5e336f.tar.gz
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 <michael.lukashov@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h8
1 files changed, 8 insertions, 0 deletions
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);