documentation: add documentation for the bitmap format
[git/git-svn.git] / pack-objects.h
blob90ad0a8f4f8cc68f5594e388055cd3949a936a9a
1 #ifndef PACK_OBJECTS_H
2 #define PACK_OBJECTS_H
4 struct object_entry {
5 struct pack_idx_entry idx;
6 unsigned long size; /* uncompressed size */
7 struct packed_git *in_pack; /* already in pack */
8 off_t in_pack_offset;
9 struct object_entry *delta; /* delta base object */
10 struct object_entry *delta_child; /* deltified objects who bases me */
11 struct object_entry *delta_sibling; /* other deltified objects who
12 * uses the same base as me
14 void *delta_data; /* cached delta (uncompressed) */
15 unsigned long delta_size; /* delta data size (uncompressed) */
16 unsigned long z_delta_size; /* delta data size (compressed) */
17 enum object_type type;
18 enum object_type in_pack_type; /* could be delta */
19 uint32_t hash; /* name hint hash */
20 unsigned char in_pack_header_size;
21 unsigned preferred_base:1; /*
22 * we do not pack this, but is available
23 * to be used as the base object to delta
24 * objects against.
26 unsigned no_try_delta:1;
27 unsigned tagged:1; /* near the very tip of refs */
28 unsigned filled:1; /* assigned write-order */
31 struct packing_data {
32 struct object_entry *objects;
33 uint32_t nr_objects, nr_alloc;
35 int32_t *index;
36 uint32_t index_size;
39 struct object_entry *packlist_alloc(struct packing_data *pdata,
40 const unsigned char *sha1,
41 uint32_t index_pos);
43 struct object_entry *packlist_find(struct packing_data *pdata,
44 const unsigned char *sha1,
45 uint32_t *index_pos);
47 static inline uint32_t pack_name_hash(const char *name)
49 uint32_t c, hash = 0;
51 if (!name)
52 return 0;
55 * This effectively just creates a sortable number from the
56 * last sixteen non-whitespace characters. Last characters
57 * count "most", so things that end in ".c" sort together.
59 while ((c = *name++) != 0) {
60 if (isspace(c))
61 continue;
62 hash = (hash >> 2) + (c << 24);
64 return hash;
67 #endif