diff --git a/tools/semver_git_tag b/tools/semver_git_tag index db09f9b..d26b696 100755 --- a/tools/semver_git_tag +++ b/tools/semver_git_tag @@ -52,21 +52,26 @@ function extra_options { echo "$extra" } -############# main +function assert_git_covered { + REPOSITORY=$(git config --get remote.origin.url) + if [[ "$?" -ne 0 ]]; then + echo 'no remote origin defined yet, please perform: git remote add' + exit 1 + fi +} -# check git covered -REPOSITORY=$(git config --get remote.origin.url) -if [[ "$?" -ne 0 ]]; then - echo 'no remote origin defined yet, please perform: git remote add' - exit 1 -fi +function assert_git_clean { + changed=$(git status -s | wc -l) + if [[ ! $changed -eq 0 ]]; then + echo "git commit required, please do so before processing further" + exit 2 + fi +} -# check if dirty status -changed=$(git status -s | wc -l) -if [[ ! $changed -eq 0 ]]; then - echo "git commit required, please do so before processing further" - exit 2 -fi +############# main + +assert_git_covered +# assert_git_clean git remote update pulled_needed=$(git status -s -u no | wc -l) @@ -113,6 +118,8 @@ if [[ $VERSION != '0.0.0' ]]; then fi parse_options $* +echo $COMMAND +exit 1 if [[ -z $COMMAND ]]; then echo -n "Press 'M' for Major, 'm' for minor, 'p' for patch ? "