diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-11-14 10:30:19 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-11-14 16:13:51 +0300 |
commit | d7a82ed463dc7687cbb0814de66283835bcaa3d0 (patch) | |
tree | 120a6df7bb1dda6d01db75d468d26612a592730b /Makefile | |
parent | c952a9f6f75174ac933d5e964fae4e18c0f1fe65 (diff) |
Makefile: Fix broken Git version in nightly CI jobs
In our nightly CI jobs we test with Git's `main` respectivey `next`
branch. Starting with 8bd7becbb (Makefile: Use Gitaly's tagged Git
versions instead of ad-hoc patching, 2022-11-11), we unconditionally
write the `GIT_VERSION` into Git's source tree to override the version
that e.g. `git --version` would report. But when `GIT_VERSION=master`,
then we fail to parse the Git version in Gitaly and thus fail all code
paths that depend on this.
Fix this by introducing a new variable that, if set, skips overriding
the Git version. This variable is set in our nightly jobs now.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -137,6 +137,11 @@ GIT_VERSION_2_37_1 ?= v2.37.1.gl1 ## The Git version used for bundled Git v2.38. GIT_VERSION_2_38 ?= v2.38.1.gl0 +## Skip overriding the Git version and instead use the Git version as specified +## in the Git sources. This is required when building Git from a version that +## cannot be parsed by Gitaly. +SKIP_OVERRIDING_GIT_VERSION ?= + # The default version is used in case the caller does not set the variable or # if it is either set to the empty string or "default". ifeq (${GIT_VERSION:default=},) @@ -660,10 +665,14 @@ ${DEPENDENCY_DIR}/git-%/Makefile: ${DEPENDENCY_DIR}/git-%.version ${Q}${GIT} -C "${@D}" fetch --depth 1 ${GIT_QUIET} origin ${GIT_VERSION} ${Q}${GIT} -C "${@D}" reset --hard ${Q}${GIT} -C "${@D}" checkout ${GIT_QUIET} --detach FETCH_HEAD +ifdef SKIP_OVERRIDING_GIT_VERSION + ${Q}rm -f "${@D}"/version +else @ # We're writing the version into the "version" file in Git's own source @ # directory. If it exists, Git's Makefile will pick it up and use it as @ # the version instead of auto-detecting via git-describe(1). ${Q}echo ${GIT_VERSION} >"${@D}"/version +endif ${Q}touch $@ $(patsubst %,${DEPENDENCY_DIR}/git-\%/%,${GIT_EXECUTABLES}): ${DEPENDENCY_DIR}/git-%/Makefile |