aboutsummaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2026-03-27 16:06:46 -0400
committerJunio C Hamano <gitster@pobox.com>2026-03-27 13:40:39 -0700
commitd31d1f2e06942046b5220942c77245725d7df2c1 (patch)
treefbe5f0e660ceadbee570ba1e757f945211384158 /path.c
parent81e29064371c4b4599b171ac71e73d1e21475a63 (diff)
downloadgit-d31d1f2e06942046b5220942c77245725d7df2c1.tar.xz
pack-objects: refactor `read_packs_list_from_stdin()` to use `strmap`
The '--stdin-packs' mode of pack-objects maintains two separate string_lists: one for included packs, and one for excluded packs. Each list stores the pack basename as a string and the corresponding `packed_git` pointer in its `->util` field. This works, but makes it awkward to extend the set of pack "kinds" that pack-objects can accept via stdin, since each new kind would need its own string_list and duplicated handling. A future commit will want to do just this, so prepare for that change by handling the various "kinds" of packs specified over stdin in a more generic fashion. Namely, replace the two `string_list`s with a single `strmap` keyed on the pack basename, with values pointing to a new `struct stdin_pack_info`. This struct tracks both the `packed_git` pointer and a `kind` bitfield indicating whether the pack was specified as included or excluded. Extract the logic for sorting packs by mtime and adding their objects into a separate `stdin_packs_add_pack_entries()` helper. While we could have used a `string_list`, we must handle the case where the same pack is specified more than once. With a `string_list` only, we would have to pay a quadratic cost to either (a) insert elements into their sorted positions, or (b) a repeated linear search, which is accidentally quadratic. For that reason, use a strmap instead. This patch does not include any functional changes. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'path.c')
0 files changed, 0 insertions, 0 deletions