Skip to content

Commit e64dc6b

Browse files
committed
More defensive makefile
Signed-off-by: apostasie <[email protected]>
1 parent bb85aae commit e64dc6b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ DOCDIR ?= $(DATADIR)/doc
3939

4040
BINARY ?= "nerdctl"
4141
MAKEFILE_DIR := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
42-
VERSION ?= $(shell git -C $(MAKEFILE_DIR) describe --match 'v[0-9]*' --dirty='.m' --always --tags)
42+
VERSION ?= $(shell git -C $(MAKEFILE_DIR) describe --match 'v[0-9]*' --dirty='.m' --always --tags 2>/dev/null || echo no_git_information)
4343
VERSION_TRIMMED := $(VERSION:v%=%)
44-
REVISION ?= $(shell git -C $(MAKEFILE_DIR) rev-parse HEAD)$(shell if ! git -C $(MAKEFILE_DIR) diff --no-ext-diff --quiet --exit-code; then echo .m; fi)
44+
REVISION ?= $(shell git -C $(MAKEFILE_DIR) rev-parse HEAD 2>/dev/null || echo no_git_information)$(shell if ! git -C $(MAKEFILE_DIR) diff --no-ext-diff --quiet --exit-code 2>/dev/null; then echo .m; fi)
4545
LINT_COMMIT_RANGE ?= main..HEAD
4646
GO_BUILD_LDFLAGS ?= -s -w
4747
GO_BUILD_FLAGS ?=

0 commit comments

Comments
 (0)