Skip to content

ref: Skip loading of peeled non-tag objects in FindAllTags

The new gitpipe-based implementation for the FindAllTags() RPC works in three steps:

1. We load all references in "refs/tags". At this point in time, we
   don't yet have information about the object's type.

2. For each reference, we load object info about the object _and_
   the peeled object via "^{}". This allows us to opportunistically
   request information about the object's target if the object
   happens to be a tag. If not, then the peeled object is going to
   be the object itself.

3. We load the actual object data both of the object itself as well
   as of the peeled object.

While this design works, we needlessly load object data of non-tag objects twice because we always request data both of the object and the peeled target.

We can easily optimize this pattern as soon as we've got information about the object's type: if the object is a tag, then we do want to load the tagged object. Otherwise, if it's not a tag, then we know it's useless to request the same data twice and can thus skip requesting object data about the peeled object.

Implement this optimization via a new CatfileInfoFilter() which encodes this via a simple state machine to avoid these useless reads.

Changelog: performance

Part of #3142 (closed)

Merge request reports