Skip to content

Commit

Permalink
Display message when no tags are in local repository (#1047)
Browse files Browse the repository at this point in the history
  • Loading branch information
thom-at-redhat authored May 21, 2024
1 parent 445c311 commit 6b713a1
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# If the current commit has been tagged, use that as the version.
# Otherwise include short commit hash.
# If the current git commit has been tagged, use <tag> as the version. (e.g. v1.4.5)
# Otherwise the version is <tag>+git<short commit hash> (e.g. 1.4.5+f031d2)
OFFICIAL_VERSION := $(shell if VER=`git describe --exact-match --tags 2>/dev/null`; then echo $$VER; else echo ""; fi)
ifeq ($(OFFICIAL_VERSION),)
VERSION := $(shell git describe --tags | cut -d - -f -1)+$(shell git rev-parse --short HEAD)
else
VERSION := $(OFFICIAL_VERSION)
ifneq ($(OFFICIAL_VERSION),)
VERSION := $(OFFICIAL_VERSION)
else ifneq ($(shell git tag --list),)
VERSION := $(shell git describe --tags | cut -d - -f -1)+$(shell git rev-parse --short HEAD)
else ifeq ($(VERSION),)
VERSION := $(error No tags found in git repository)
# else VERSION was passed as a command-line argument to make
endif


Expand Down

0 comments on commit 6b713a1

Please sign in to comment.