]> git.ipfire.org Git - thirdparty/git.git/commit
midx-write.c: extract `should_include_pack()`
authorTaylor Blau <me@ttaylorr.com>
Wed, 29 May 2024 22:55:32 +0000 (18:55 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 30 May 2024 20:43:51 +0000 (13:43 -0700)
commit364c0ffc5a3b23071eced255b50f1191a0deffd7
treef9b746002030c3bc266d73658aed246c35b8b6ab
parent33e9218ffbc98618896587d72eab18178f483a17
midx-write.c: extract `should_include_pack()`

The add_pack_to_midx() callback used via for_each_file_in_pack_dir() is
used to add packs with .idx files to the MIDX being written.

Within this function, we have a pair of checks that discards packs
which:

  - appear in an existing MIDX, if we successfully read an existing MIDX
    from disk

  - or, appear in the "to_include" list, if invoking the MIDX write
    machinery with the `--stdin-packs` command-line argument.

A future commit will want to call a slight variant of these checks from
the code that reuses all packs from an existing MIDX, as well as the
current location via add_pack_to_midx(). The latter will be modified in
subsequent commits to only reuse packs which appear in the to_include
list, if one was given.

Prepare for that step by extracting these checks as a subroutine that
may be called from both places.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
midx-write.c