From d8ae450784d00271ce23f958fb17ac9f8eec2b59 Mon Sep 17 00:00:00 2001 From: Erik Grinaker Date: Thu, 10 Dec 2020 10:45:35 +0100 Subject: [PATCH] Makefile: use git 2.20-compatible branch detection (#5778) `Makefile` used `git branch --show-current` for branch detection. This option was introduced in Git 2.22. However, the current Debian release (Buster), which is used by the `golang:1.15` Docker image, uses Git 2.20. This gives spurious errors e.g. when running the E2E tests: ``` error: unknown option `show-current' ``` This PR changes the branch detection to be compatible with Git 2.20. The behavior appears to be the same as `git branch --show-current`, both when on a branch, on a tag, and on a detached HEAD. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index dd8e2b51a..34d1f7da2 100644 --- a/Makefile +++ b/Makefile @@ -6,8 +6,8 @@ BUILDDIR ?= $(CURDIR)/build BUILD_TAGS?=tendermint # If building a release, please checkout the version tag to get the correct version setting -ifneq ($(shell git branch --show-current),) -VERSION := unreleased-$(shell git branch --show-current)-$(shell git rev-parse HEAD) +ifneq ($(shell git symbolic-ref -q --short HEAD),) +VERSION := unreleased-$(shell git symbolic-ref -q --short HEAD)-$(shell git rev-parse HEAD) else VERSION := $(shell git describe) endif