Subject: Re: [PATCH 4/8] packfile: always populate pack-specific info when reading object info

From: Junio C Hamano <[email-masked]>
Date: Thu, 18 Dec 2025 16:32:02 +0900

Patrick Steinhardt <[email-masked]> writes:

> @@ -2148,8 +2162,13 @@ int packfile_store_read_object_info(struct packfile_store *store,
>  	 * We know that the caller doesn't actually need the
>  	 * information below, so return early.
>  	 */
> -	if (oi == &blank_oi)
> +	if (oi == &blank_oi) {
> +		oi->whence = OI_PACKED;
> +		oi->u.packed.offset = e.offset;
> +		oi->u.packed.pack = e.p;
> +		oi->u.packed.type = PACKED_OBJECT_TYPE_UNKNOWN;

It cannot be seen as it is before the precontext, but if blank_oi is
still a function scope static that is initialized only once by
assigning OBJECT_INFO_INIT, this will leave a timg bomb waiting to
go off, as it violates the "blank"-ness promise for the next caller
of this function who calls NULL in oi.

I'd prefer we fix this nonsense "we only declared a function scope
static, but without actually using it for anything, other than to
compare its address with the caller supplied parameter" well before
this step.