From 465fbba7d1ff8a164f811e31976f653b744c3140 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Mon, 5 Apr 2021 11:53:06 -0400 Subject: [PATCH] Handle tagless versions (#606) Average case: git describe --tags v0.2.9-130-g47e1ba1 git describe --tags --dirty --always | cut -c 2- 0.2.9-130-g47e1ba1 git describe --tags --dirty --always | sed -e s/^v// 47e1ba1 Edge case (no tags): git describe --tags --dirty --always 47e1ba1 git describe --tags --dirty --always | cut -c 2- 7e1ba1 -- this is undesirable --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8b9d3a71..8f3c3ae3 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ PREFIX ?= /usr/local -VERSION ?= $(shell git describe --tags --dirty --always | cut -c 2-) +VERSION ?= $(shell git describe --tags --dirty --always | sed -e 's/^v//') IS_SNAPSHOT = $(if $(findstring -, $(VERSION)),true,false) MAJOR_VERSION = $(word 1, $(subst ., ,$(VERSION))) MINOR_VERSION = $(word 2, $(subst ., ,$(VERSION)))