]> git.ipfire.org Git - thirdparty/git.git/commit - midx.c
midx: simplify computation of pack name lengths
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)
commitdba6175c64cdc9485198395b4c3c715fd2402230
tree107c9b48ad704944f2c56d0f65a44a9bb355651b
parentcff97116160e57741c9a954a51bfcb0057b3e89d
midx: simplify computation of pack name lengths

Before writing the multi-pack-index, we compute the length of the
pack-index names concatenated together. This forms the data in the
pack name chunk, and we precompute it to compute chunk offsets.
The value is also modified to fit alignment needs.

Previously, this computation was coupled with adding packs from
the existing multi-pack-index and the remaining packs in the object
dir not already covered by the multi-pack-index.

In anticipation of this becoming more complicated with the 'expire'
subcommand, simplify the computation by centralizing it to a single
loop before writing the file.

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