Re: [PATCH 1/7] loose: drop unused `repo_write_loose_object_map()`
Patrick Steinhardt <ps@pks.im> writes:
Show 30 quoted lines
> On Mon, Oct 19, 2026 at 01:21:08PM -0700, Karthik Nayak wrote:
>> Patrick Steinhardt <ps@pks.im> writes:
>>
>> > The function `repo_write_loose_object_map()` was introduced in
>> > 23b2c7e95b (loose: add a mapping between SHA-1 and SHA-256 for loose
>> > objects, 2023-10-01), but it never had any callers as loose object maps
>> > are instead written incrementally via `repo_add_loose_object_map()`
>> > whenever a new loose object is created.
>> >
>> > Besides being dead code, the function also hardcodes the location of the
>> > "loose-object-idx" file as "$GIT_COMMON_DIR/objects", whereas both the
>> > reader and `repo_add_loose_object_map()` derive the location from the
>> > loose source's path. The function would thus disagree with everyone else
>> > where the loose object map is supposed to be located when the object
>> > directory is using a non-default location.
>> >
>> > Remove the function.
>> >
>>
>> It's like the function being unused is an insufficient argument by
>> itself, so we also talk about why its incorrect. Made me chuckle.
>
> Yeah. The only reason that I even stumbled over this function is that
> it'll break with the object storage format extension, because it would
> put files into the wrong location. I only realized later on that the
> function isn't even used at all. But that probably explains why this
> message is a bit on the excessive side.
>
> Should I trim it?
>
I think its good, I just was amused by it.
> Patrick