From 4e2dee43624d381d8fcc55cea8d468c847b6a989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Mon, 22 Aug 2022 22:31:30 +0200 Subject: [PATCH 1/2] Remove unused GIT_BRANCH definition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miloslav Trmač --- Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Makefile b/Makefile index 6a8f3448..5137c626 100644 --- a/Makefile +++ b/Makefile @@ -55,8 +55,6 @@ ifeq ($(GOOS), linux) endif endif -GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null) - # If $TESTFLAGS is set, it is passed as extra arguments to 'go test'. # You can increase test output verbosity with the option '-test.vv'. # You can select certain tests to run, with `-test.run ` for example: From f36752a279eaaa28606c8b684ffb657920a97c16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Mon, 22 Aug 2022 22:33:32 +0200 Subject: [PATCH 2/2] Don't include git commit from a parent directory in the --version output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This can happen when building RPMs out of tarballs (which don't contain the .git repository). To test: > make -n /bin/skopeo; mv .git ../.git ; make -n bin/skopeo Fixes #1707 . Signed-off-by: Miloslav Trmač --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5137c626..8512ca43 100644 --- a/Makefile +++ b/Makefile @@ -90,7 +90,7 @@ endif CONTAINER_GOSRC = /src/github.com/containers/skopeo CONTAINER_RUN ?= $(CONTAINER_CMD) --security-opt label=disable -v $(CURDIR):$(CONTAINER_GOSRC) -w $(CONTAINER_GOSRC) $(SKOPEO_CIDEV_CONTAINER_FQIN) -GIT_COMMIT := $(shell git rev-parse HEAD 2> /dev/null || true) +GIT_COMMIT := $(shell GIT_CEILING_DIRECTORIES=$$(cd ..; pwd) git rev-parse HEAD 2> /dev/null || true) EXTRA_LDFLAGS ?= SKOPEO_LDFLAGS := -ldflags '-X main.gitCommit=${GIT_COMMIT} $(EXTRA_LDFLAGS)'