pack-objects.hon commit doc: remove reference to the traditional layout in git-tag.txt (749a227)
   1#ifndef PACK_OBJECTS_H
   2#define PACK_OBJECTS_H
   3
   4struct 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
  13                                             */
  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 int in_pack_pos;
  21        unsigned char in_pack_header_size;
  22        unsigned preferred_base:1; /*
  23                                    * we do not pack this, but is available
  24                                    * to be used as the base object to delta
  25                                    * objects against.
  26                                    */
  27        unsigned no_try_delta:1;
  28        unsigned tagged:1; /* near the very tip of refs */
  29        unsigned filled:1; /* assigned write-order */
  30};
  31
  32struct packing_data {
  33        struct object_entry *objects;
  34        uint32_t nr_objects, nr_alloc;
  35
  36        int32_t *index;
  37        uint32_t index_size;
  38};
  39
  40struct object_entry *packlist_alloc(struct packing_data *pdata,
  41                                    const unsigned char *sha1,
  42                                    uint32_t index_pos);
  43
  44struct object_entry *packlist_find(struct packing_data *pdata,
  45                                   const unsigned char *sha1,
  46                                   uint32_t *index_pos);
  47
  48static inline uint32_t pack_name_hash(const char *name)
  49{
  50        uint32_t c, hash = 0;
  51
  52        if (!name)
  53                return 0;
  54
  55        /*
  56         * This effectively just creates a sortable number from the
  57         * last sixteen non-whitespace characters. Last characters
  58         * count "most", so things that end in ".c" sort together.
  59         */
  60        while ((c = *name++) != 0) {
  61                if (isspace(c))
  62                        continue;
  63                hash = (hash >> 2) + (c << 24);
  64        }
  65        return hash;
  66}
  67
  68#endif