On 6/9/2018 1:28 PM, Duy Nguyen wrote:
On Thu, Jun 7, 2018 at 4:06 PM Derrick Stolee <sto...@gmail.com> wrote:
@@ -117,9 +123,13 @@ struct midxed_git *load_midxed_git(const char *object_dir)
                 die("MIDX missing required pack lookup chunk");
         if (!m->chunk_pack_names)
                 die("MIDX missing required pack-name chunk");
+       if (!m->chunk_oid_fanout)
+               die("MIDX missing required OID fanout chunk");
_()

@@ -501,9 +540,13 @@ int write_midx_file(const char *object_dir)
         chunk_offsets[cur_chunk] = chunk_offsets[cur_chunk - 1] + nr_packs * 
sizeof(uint32_t);

         cur_chunk++;
-       chunk_ids[cur_chunk] = MIDX_CHUNKID_OIDLOOKUP;
+       chunk_ids[cur_chunk] = MIDX_CHUNKID_OIDFANOUT;
Err.. mistake?

Not a mistake, just a side-effect of inserting the fanout before the lookup.

The commits are in this order because we need to construct the list before we build the fanout, but it makes sense to have the smaller fanout chunk before the lookup chunk.


         chunk_offsets[cur_chunk] = chunk_offsets[cur_chunk - 1] + 
pack_name_concat_len;

+       cur_chunk++;
+       chunk_ids[cur_chunk] = MIDX_CHUNKID_OIDLOOKUP;
Same here.

+       chunk_offsets[cur_chunk] = chunk_offsets[cur_chunk - 1] + 
MIDX_CHUNK_FANOUT_SIZE;
+
         cur_chunk++;
         chunk_ids[cur_chunk] = 0;
         chunk_offsets[cur_chunk] = chunk_offsets[cur_chunk - 1] + nr_entries * 
MIDX_HASH_LEN;


Reply via email to