Subject: Re: [PATCH v2 2/5] pack-objects: refactor `read_packs_list_from_stdin()` to use `strmap`

From: Taylor Blau <[email-masked]>
Date: Thu, 26 Mar 2026 18:37:36 -0400

On Wed, Mar 25, 2026 at 07:51:50PM -0400, Taylor Blau wrote:
> +static void stdin_packs_add_pack_entries(struct strmap *packs,
> +					 struct rev_info *revs)
> +{
> +	struct string_list keys = STRING_LIST_INIT_NODUP;
> +	struct string_list_item *item;
> +	struct hashmap_iter iter;
> +	struct strmap_entry *entry;
> +
> +	strmap_for_each_entry(packs, &iter, entry) {
> +		struct stdin_pack_info *info = entry->value;
> +		if (!info->p)
> +			die(_("could not find pack '%s'"), entry->key);
> +
> +		string_list_append(&keys, entry->key)->util = info;
> +	}
> +
> +	/*
> +	 * Order packs by ascending mtime; use QSORT directly to access the
> +	 * string_list_item's ->util pointer, which string_list_sort() does not
> +	 * provide.
> +	 */
> +	QSORT(keys.items, keys.nr, pack_mtime_cmp);

Yikes, this is definitely not right. pack_mtime_cmp expects the ->util
field to be a pointer to a packed_git structure, not a stdin_pack_info
one.

Indeed, this fails the ASan CI builds, which I didn't notice as I sent
this series off towards the very end of my workday yesterday.

I'll need to resubmit this series to fix this, but I'll hold off on
doing so until the discussion in response to Stolee's review of this
round settles first.

Thanks,
Taylor