]> git.ipfire.org Git - thirdparty/git.git/commit - midx.c
midx: refactor permutation logic and pack sorting
authorDerrick Stolee <dstolee@microsoft.com>
Mon, 10 Jun 2019 23:35:24 +0000 (16:35 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 11 Jun 2019 17:34:40 +0000 (10:34 -0700)
commitd01bf2e609bf792820023fc0f4ef5048bc689327
tree6a669d3deca950a3bfe395a13e5e0103c78cfbd8
parentdba6175c64cdc9485198395b4c3c715fd2402230
midx: refactor permutation logic and pack sorting

In anticipation of the expire subcommand, refactor the way we sort
the packfiles by name. This will greatly simplify our approach to
dropping expired packs from the list.

First, create 'struct pack_info' to replace 'struct pack_pair'.
This struct contains the necessary information about a pack,
including its name, a pointer to its packfile struct (if not
already in the multi-pack-index), and the original pack-int-id.

Second, track the pack information using an array of pack_info
structs in the pack_list struct. This simplifies the logic around
the multiple arrays we were tracking in that struct.

Finally, update get_sorted_entries() to not permute the pack-int-id
and instead supply the permutation to write_midx_object_offsets().
This requires sorting the packs after get_sorted_entries().

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
midx.c