File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -47,13 +47,18 @@ tag_checked_out:
4747# In this case we might in some situations see an error like
4848# `/bin/bash: line 1: 2b55bbb: value too great for base (error token is "2b55bbb")`
4949# which can be ignored.
50- GITDESC := $(shell git describe --tags --always)
50+ GITDESC := $(shell git describe --tags --always 2>/dev/null || true)
51+ CURRENT_FOLDER_NAME := $(notdir $(CURDIR ) )
52+ ifeq ($(strip $(GITDESC ) ) ,)
53+ SEMVER := $(CURRENT_FOLDER_NAME )
54+ else
5155GITDESCPATCH := $(shell echo '$(GITDESC ) ' | sed -E 's/v?[0-9]+\.[0-9]+\.([0-9]+) [-+]?.*/\1/')
5256SEMVERPATCH := $(shell echo $$(( $(GITDESCPATCH ) + 1 ) ) )
5357# Hint: The second regexp in the next line only matches
5458# if there is a hyphen (`-`) followed by a number,
5559# by which we assume that git describe has added a string after the tag
5660SEMVER := $(shell echo '$(GITDESC ) ' | sed -E -e 's/^v//' -e 's/([0-9]+\.[0-9]+\.) ([0-9]+)(-[1-9].*)/\1$(SEMVERPATCH ) \3/' )
61+ endif
5762testsemver :
5863 @echo from \' $(GITDESC ) \' transformed to \' $(SEMVER ) \'
5964
You can’t perform that action at this time.
0 commit comments