diff --git a/modules/git/bootstrap.Makefile b/modules/git/bootstrap.Makefile index 79eee578..76ca07de 100644 --- a/modules/git/bootstrap.Makefile +++ b/modules/git/bootstrap.Makefile @@ -1,9 +1,8 @@ GIT:= $(shell which git) export GIT_COMMIT ?= $(shell $(GIT) rev-parse --verify HEAD) -export GIT_COMMIT_SHORT ?= $(shell $(GIT) rev-parse --verify --short HEAD) -export GIT_BRANCH ?= $(shell $(GIT) branch | grep \* | cut -d ' ' -f2 | grep -Ev "^\W" ) - +export GIT_COMMIT_SHORT ?= $(shell $(GIT) rev-parse --verify --short HEAD) +export GIT_BRANCH ?= $(shell $(GIT) rev-parse --abbrev-ref HEAD) export GIT_LATEST_TAG ?= $(shell $(GIT) describe --tags --abbrev=0 2>/dev/null) ifeq ($(GIT_LATEST_TAG),) @@ -16,7 +15,6 @@ else export GIT_IS_BRANCH := 1 endif - ifeq ($(shell $(GIT) describe --exact-match --tags 2>/dev/null),) export GIT_IS_TAG := 0 else diff --git a/modules/git/template/module.sh b/modules/git/template/module.sh index 8ef406b1..3b832d1a 100644 --- a/modules/git/template/module.sh +++ b/modules/git/template/module.sh @@ -8,7 +8,7 @@ function git-template-prepare-data { cat << EOF > $GIT_FILE --- url: $(git ls-remote --get-url) - name: $(git ls-remote --get-url | grep -oP "(?<=\/).*(?=.git)") + name: $(basename `git ls-remote --get-url` .git) commit: ${GIT_COMMIT} commit_short: ${GIT_COMMIT_SHORT} branch: ${GIT_BRANCH} diff --git a/modules/stages/Makefile b/modules/stages/Makefile index 89157e26..ea45a2c4 100644 --- a/modules/stages/Makefile +++ b/modules/stages/Makefile @@ -5,8 +5,8 @@ ifeq ($(GIT_IS_TAG),1) endif ifeq ($(GIT_IS_BRANCH),1) - ifneq ($(shell echo $(GIT_BRANCH) | grep -Po $(FEATURE_PATTERN)),) - FEATURE ?= $(shell echo $(GIT_BRANCH) | grep -Po $(FEATURE_PATTERN)) + ifneq ($(shell echo $(GIT_BRANCH) | grep -Eo $(FEATURE_PATTERN)),) + FEATURE ?= $(shell echo $(GIT_BRANCH) | grep -Eo $(FEATURE_PATTERN)) else FEATURE ?= "$(GIT_BRANCH)" endif