Re: [PATCH 14/16] packfile: remove `get_packed_git()`
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Aug 20, 2025, 13:50 UTC
- Message-ID
- <CAOLa=ZR7eXDAsrRifyvxzTt9RwSR1TcQFs4KLaV7n6byxQM0zA@mail.gmail.com>
- In-Reply-To
- <20250819-b4-pks-packfiles-store-v1-14-1660842e125a@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 8 quoted lines
> We have two different functions to retrieve packfiles for a packfile > store: > > - `get_packed_git()` returns the list of packfiles directly. > > - `get_all_packs()` does more work and also prepares packfiles that > are being indexed by a multi-pack-index. >
Question, under what situation would a packfile not returned by `get_packed_git()` but be indexed by a multi-pack-index.
Show 15 quoted lines
> The distinction is not immediately obvious. Furthermore, to make the > situation even worse, `get_packed_git()` would return the same result as > `get_all_packs()` once the latter has been called once as they both > refer to the same list. > > As it turns out, the distinction isn't necessary. We only have a couple > of callers of `get_packed_git()`, and all of those callers are prepared > to call `get_all_packs()` instead: > > - "builtin/gc.c": We explicitly check how many packfiles aren't > contained in the multi-pack-index, so loading extra packfiles that > are indexed by it won't change the result. > > - "builtin/grep.c": We only care `get_packed_git()` to prepare eagerly > load packfiles. In the preceding commit we have started to expose
Nit: the first sentence reads a bit weird.
Show 10 quoted lines
> `packfile_store_prepare()`, which is a more direct way of achieving > the same result. > > - "object-name.c": `find_abbrev_len_for_pack()` and `unique_in_pack()` > exit early in case the multi-pack index is set, so both callsites of > `get_packed_git()` know to handle packs loaded via the MIDX already. > > Convert all of these sites to use `get_all_packs()` instead and remove > `get_packed_git()`. >
[snip]