Skip to content

localrepo: Use protocol v2 for internal fetches

When spawning git-upload-pack(1) we need to splice through GIT_PROTOCOL such that we can tell which Git protocol shall be used. Right now, we support both protocol v0, which is the default protocol, and protocol v2, which is a newer iteration of this protocol. Wherever possible we want to use v2, which provides some benefits for us like being able to skip the initial reference advertisement phase in case we're only fetching a subset of references.

While we have the setup in place to pass through the protocol version for the SSH-based transport, we do not currently use it when doing internal fetches. As a result, we fall back to v0 of the protocol and thus miss out on any potentially new features.

Fix this by requesting protocol v2 for internal fetches.

Changelog: performance

Part of https://gitlab.com/gitlab-org/gitaly/-/issues/2436

Merge request reports