diff options
| author | Taylor Blau <me@ttaylorr.com> | 2026-03-27 16:06:46 -0400 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-03-27 13:40:39 -0700 |
| commit | d31d1f2e06942046b5220942c77245725d7df2c1 (patch) | |
| tree | fbe5f0e660ceadbee570ba1e757f945211384158 /gitk-git/Makefile | |
| parent | 81e29064371c4b4599b171ac71e73d1e21475a63 (diff) | |
| download | git-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 'gitk-git/Makefile')
0 files changed, 0 insertions, 0 deletions
