Skip to content

Commit

Permalink
Merge pull request #715 from tjaartvdwalt/master
Browse files Browse the repository at this point in the history
Fix bugs with git-release --semver
  • Loading branch information
spacewander authored May 8, 2018
2 parents d024755 + 658f133 commit 3802e83
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/git-release
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ if test $# -gt 0; then
latest_tag=$(git describe --tags "$(git rev-list --tags --max-count=1)")

if [[ ! "$latest_tag" =~ \
^([^0-9]*)([0-9]|[1-9][0-9]+)\.([0-9]|[1-9][0-9]+)\.([0-9]|[1-9][0-9]+)(.*) ]]; then
^([^0-9]*)([1-9][0-9]+|[0-9])\.([1-9][0-9]+|[0-9])\.([1-9][0-9]+|[0-9])(.*) ]]; then
echo "the latest tag doesn't match semver format requirement" 1>&2
exit 1
fi
Expand All @@ -75,8 +75,8 @@ if test $# -gt 0; then
(( ++version ))

case "$semver" in
major ) version="${BASH_REMATCH[1]}$version.${BASH_REMATCH[3]}.${BASH_REMATCH[4]}${BASH_REMATCH[5]}" ;;
minor ) version="${BASH_REMATCH[1]}${BASH_REMATCH[2]}.$version.${BASH_REMATCH[4]}${BASH_REMATCH[5]}" ;;
major ) version="${BASH_REMATCH[1]}$version.0.0${BASH_REMATCH[5]}" ;;
minor ) version="${BASH_REMATCH[1]}${BASH_REMATCH[2]}.$version.0${BASH_REMATCH[5]}" ;;
patch ) version="${BASH_REMATCH[1]}${BASH_REMATCH[2]}.${BASH_REMATCH[3]}.$version${BASH_REMATCH[5]}" ;;
esac
fi
Expand Down

0 comments on commit 3802e83

Please sign in to comment.