precommit update

This commit is contained in:
dr. M.S. (Matthijs) Berends committed 2022-10-21 19:31:46 +02:00
1 parent faca6d608a
commit bfca21bd3f
4 files changed
+12 -8

No files matched your search

+6 -4
View File
@@ -59,19 +59,21 @@ echo "Updating semantic versioning and date..."
git fetch origin --prune --prune-tags --quiet
currenttagfull=`git describe --tags --abbrev=0`
currenttag=`git describe --tags --abbrev=0 | sed 's/v//'`
# assume main branch to be 'main' or 'master', pick the right name:
defaultbranch=`git branch | cut -c 3- | grep -E '^master$|^main$'`
if [ "$currenttag" = "" ]; then
# there is no tag, so set tag to 0.0.1 and commit index to current count
echo "- no git tags found, create one in this format: 'v(x).(y).(z)'!"
currenttag="0.0.1"
currentcommit=`git rev-list --count HEAD`
currentcommit=`git rev-list --count ${defaultbranch}`
echo "- no git tags found, create one in format 'v(x).(y).(z)' - curently ${currentcommit} previous commits in ${defaultbranch}"
else
# there is a tag, so base version number on that
currentcommit=`git rev-list --count ${currenttagfull}..HEAD`
currentcommit=`git rev-list --count ${currenttagfull}..${defaultbranch}`
if (( "$currentcommit" == 0 )); then
# tag is new, so this must become the version number
currentversion="$currenttag"
fi
echo "- latest tag is '${currenttagfull}', with ${currentcommit} previous commits"
echo "- latest tag is '${currenttagfull}', with ${currentcommit} previous commits in ${defaultbranch}"
fi
if [ "$currentversion" = "" ]; then
# combine tag (e.g. 1.2.3) and commit number (like 5) increased by 9000 to indicate beta version