Skip to content

Makefile: Build Git with extra GitLab patch level version

Patrick Steinhardt requested to merge pks-git-extra-version into master

With Gitaly now being the single source of truth for the Git version deployed in production, we have started to make a lot more use of applying patches on top of our self-built Git version. The policy is and will remain to only ever apply patches which have been accepted upstream, but it is sensible to allow for backporting patches such that we can make use of them faster and test whether they have the expected benefits.

This has uncovered a problem though: it's impossible for us to detect which patches have been applied on top. This makes it hard for admins to see whether they are running a custom version of Git or the mainline version, and it is a problem for Gitaly because we cannot detect what the current version supports in case we backport important fixes which require changes both in Git and Gitaly.

Introduce a new Git extra version into our build process. This extra version is a simple counter "gl${PATCHLEVEL}", where each newly added set of Git patches must from now on increment the extra version. With this version in place, we can fix both of above usecases.

When setting the Git version, we need to be careful to not break our Git version parsing. But luckily, the current code is very lenient with regards to parsing the fourth tuple: we only recognize the "rc" prefix, but ignore everything else. Adding the GitLab patch level as this fourth tuple is thus backwards compatible with older Gitaly versions, which will simply ignore it. The end result is thus:

$ git --version
git version 2.33.0.gl1

It still needs an admin to correlate the set of patches with the patch level, but this should be an easy enough task and is easier to maintain on our side compared to somehow encoded "real" capabilities into the version string.

Changelog: added

Fixes #3735 (closed)

Required as part of #3761 (closed)

Merge request reports

Loading