mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 10:31:53 +02:00
precommit update
This commit is contained in:
10
.github/prehooks/pre-commit
vendored
10
.github/prehooks/pre-commit
vendored
@ -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
|
||||
|
Reference in New Issue
Block a user