Subject: Re: [PATCH v4 00/14] refs: improvements and fixes for peeling tags

From: Junio C Hamano <[email-masked]>
Date: Thu, 23 Oct 2025 16:06:01 -0700

Patrick Steinhardt <[email-masked]> writes:

> originally, all I wanted to do was the last patch: a small performance
> optimization that stops parsing objects in git-for-each-ref(1) unless we
> really need to parse them. But that fix cause one specific test to fail,
> and only with the reftable backend. So this led me down the rabbit hole
> of tag peeling, ending up with this patch series.
>
> The series is structured like follows:
>
>   - Patches 1 to 8 refactor our codebase so that we don't have the
>     `peel_iterated_object()` hack anymore. I just found it hard to
>     follow and thought it shouldn't be too hard to get rid of it.
>
>   - Patches 9 and 10 remove infrastructure that we don't need anymore
>     after the first couple of patches.
>
>   - Patches 11 to 13 fix a couple of issues with peeled tags that I
>     found. The underlying issue is that tags store both the tagged
>     object and their type, but this information may not match. We never
>     verify the actual object type though when allocating the tagged
>     object, so this only blows up much later.
>
>   - Patch 14 was my original motivation, a small performance
>     optimization.
>
> I'm not particularly fond of the patches 11 to 13. It feels more like
> playing whack-a-mole, and I very much assume that there still are edge
> cases where we should properly verify the tagged object type. But
> changing it in `parse_tag_buffer()` itself causes a bunch of tests to
> fail where we intentionally create such corrupted tags. So I didn't
> really dare to touch that part, to be honest.
>
> If anybody has suggestions for an alternative approach I'd be very open
> to it.

Are you still ;-), or are we ready to declare victory for now and
mark the topic for 'next'?  It seems that another topic depends on
this and the topic itself is a good shape enough to advance.

Thanks.