Skip to content

Fix GIT_VERSION build flag overriding Git's version

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

When building Git from source, we do so via recursive invocation of make(1). This will automatically pass down any flags passed to make(1) to its child via the MAKEFLAGS environment variable so both processes have the same set of flags. As a consequence, build flags for Gitaly will leak into Git's build process.

In most cases this is harmless as variables don't clash, but there is at least one case where we mess with Git's variables: GIT_VERSION. If building Gitaly via make git GIT_VERSION=master, this variable will leak into Git's build process and cause it to assume a different version and git --version will now print "git version master". As we rely on a proper version to be present in order to determine if features are enabled or not, this breaks various features.

Fix the issue by invoking make(1) with both GIT_VERSION and MAKEFLAGS environment variables unset.

Edited by Patrick Steinhardt

Merge request reports