From 4bc009d8457f40dfaef4addc23bf9baabe1f360a Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Fri, 7 Dec 2018 22:17:09 +0000 Subject: [PATCH] Update semver behaviour --- contrib/semver/name.sh | 15 ++++++++++++--- contrib/semver/version.sh | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/contrib/semver/name.sh b/contrib/semver/name.sh index 9dbdca3..9cab7e9 100644 --- a/contrib/semver/name.sh +++ b/contrib/semver/name.sh @@ -1,10 +1,19 @@ #!/bin/sh -# Get the branch name, removing any "/" characters from pull requests -BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null | tr -d "/") +# Get the current branch name +BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null) + +# Complain if the git history is not available +if [ $? != 0 ]; then + printf "unknown" + exit -1 +fi + +# Remove "/" characters from the branch name if present +BRANCH=$(echo $BRANCH | tr -d "/") # Check if the branch name is not master -if [ "$BRANCH" = "master" ] || [ $? != 0 ]; then +if [ "$BRANCH" = "master" ]; then printf "yggdrasil" exit 0 fi diff --git a/contrib/semver/version.sh b/contrib/semver/version.sh index c23abf4..f7769a3 100644 --- a/contrib/semver/version.sh +++ b/contrib/semver/version.sh @@ -16,6 +16,7 @@ PATCH=$(git rev-list $TAG..master --count --merges --grep="from $DEVELOPBRANCH" if [ $? != 0 ]; then PATCH=$(git rev-list HEAD --count 2>/dev/null) + # Complain if the git history is not available if [ $? != 0 ]; then printf 'unknown' exit -1