Skip to content

Commit

Permalink
chore(tests): ensure git >= 2.28.0 in tests. (#1184)
Browse files Browse the repository at this point in the history
# Reason for This Change

The test infrastructure initializes repositories with an alternate
`default_branch` using the `git init -b` which was introduced in git
2.28.0

## Description of Changes

Only the UNIX makefiles were updated with the version check for now.
  • Loading branch information
i4k-tm committed Oct 19, 2023
2 parents d33be34 + 322c82b commit 405e348
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions makefiles/unix.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ GO_BUILD_FLAGS=--ldflags '-extldflags "-static"'
BUILD_ENV=CGO_ENABLED=0
EXEC_SUFFIX=

GIT_MIN_MAJOR_VERSION=2
GIT_MIN_MINOR_VERSION=28
GIT_MIN_VERSION=$(GIT_MIN_MAJOR_VERSION).$(GIT_MIN_MINOR_VERSION).0
GIT_CURRENT_VERSION=$(shell git --version | grep ^git | cut -d' ' -f3)
GIT_CURRENT_MAJOR_VERSION=$(shell echo $(GIT_CURRENT_VERSION) | cut -d. -f1)
GIT_CURRENT_MINOR_VERSION=$(shell echo $(GIT_CURRENT_VERSION) | cut -d. -f2)

IS_VALID_GIT_VERSION=$(shell expr $(GIT_CURRENT_MAJOR_VERSION) '>=' $(GIT_MIN_MAJOR_VERSION) '&' $(GIT_CURRENT_MINOR_VERSION) '>=' $(GIT_MIN_MINOR_VERSION))


ifneq "$(IS_VALID_GIT_VERSION)" "1"
$(error "$(IS_VALID_GIT_VERSION) Unsupported git version $(GIT_CURRENT_VERSION). Minimum supported version: $(GIT_MIN_VERSION)")
endif


## build a test binary -- not static, telemetry sent to localhost, etc
.PHONY: test/build
test/build: test/fakecloud
Expand Down

0 comments on commit 405e348

Please sign in to comment.