]> git.ipfire.org Git - thirdparty/git.git/commit
repack: convert "names" util bitfield to array
authorJeff King <peff@peff.net>
Sat, 22 Oct 2022 00:21:45 +0000 (20:21 -0400)
committerJunio C Hamano <gitster@pobox.com>
Sat, 22 Oct 2022 01:03:52 +0000 (18:03 -0700)
commitd3d9c51973bf3187d8767969a0aa33abe79d6240
treeceae4f5545786903776b3449829f139c9ab6a483
parentd5b41391a472dcf9486055fd5b8517f893e88daf
repack: convert "names" util bitfield to array

We keep a string_list "names" containing the hashes of packs generated
on our behalf by pack-objects. The util field of each item is treated as
a bitfield that tells us which extensions (.pack, .idx, .rev, etc) are
present for each name.

Let's switch this to allocating a real array. That will give us room in
a future patch to store more data than just a single bit per extension.
And it makes the code a little easier to read, as we avoid casting back
and forth between uintptr_t and a void pointer.

Since the only thing we're storing is an array, we could just allocate
it directly. But instead I've put it into a named struct here. That
further increases readability around the casts, and in particular helps
differentiate us from other string_lists in the same file which use
their util field differently. E.g., the existing_*_packs lists still do
bit-twiddling, but their bits have different meaning than the ones in
"names". This makes it hard to grep around the code to see how the util
fields are used; now you can look for "generated_pack_data".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/repack.c