Pack: Fixed pack version inference from git
- Consider even unannotated tags in git describe.
diff --git a/CMSIS/Utilities/gen_pack.sh b/CMSIS/Utilities/gen_pack.sh
index c4f14ee..73383cc 100755
--- a/CMSIS/Utilities/gen_pack.sh
+++ b/CMSIS/Utilities/gen_pack.sh
@@ -51,8 +51,8 @@
function git_describe()
{
- if [ git rev-parse --git-dir 2>/dev/null ]; then
- local gitversion=$(git describe --match $1* --abbrev=9 2>/dev/null || echo "$1-dirty-0-g$(git describe --match $1* --always --abbrev=9 2>/dev/null)")
+ if git rev-parse --git-dir 2>&1 >/dev/null; then
+ local gitversion=$(git describe --tags --match $1* --abbrev=9 2>/dev/null || echo "$1-dirty-0-g$(git describe --tags --match $1* --always --abbrev=9 2>/dev/null)")
local version=$(echo $gitversion | sed -r -e 's/-([0-9]+)-(g[0-9a-f]{9})/\1+\2/')
if [[ $version != $1 ]] && [[ $version == $gitversion ]]; then
version+=0
diff --git a/Jenkinsfile b/Jenkinsfile
index 8e2ef73..375bf37 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -132,7 +132,7 @@
script {
COMMIT = checkoutScmWithRetry(3)
echo "COMMIT: ${COMMIT}"
- VERSION = (sh(returnStdout: true, script: 'git describe --always')).trim()
+ VERSION = (sh(returnStdout: true, script: 'git describe --tags --always')).trim()
echo "VERSION: '${VERSION}'"
}