Added safety to release-helper.sh
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Sun, 1 Jul 2018 11:03:46 +0000 (14:03 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Sun, 1 Jul 2018 11:03:46 +0000 (14:03 +0300)
Change-Id: I4505f0e6c935a94ebd4a869e39455fe6ff10b91c

releng/doc/release-helper.sh

index 856182f223704973957a4e7ef887e6e7b8e072cc..cbd4f6206407c51575edba60311d798cf636c34b 100755 (executable)
@@ -114,12 +114,10 @@ case "$action" in
        ;;
 esac
 
-if [ ! -d $version ]; then
-       echo "Version directory '$version' does not exist yet. Please run the 'clone' action first."
-       exit -1
+if [ -n "$version" ] && [ -d $version ]; then
+       pushd $version > /dev/null
 fi
 
-pushd $version > /dev/null
 case "$action" in
        branch)
                for (( i=0; i<${repositoryCount}; i++ )); do
@@ -223,6 +221,9 @@ case "$action" in
        ;;
        *)
                echo "Usage: ${self} <version> <branch-name> <user-name> clone|branch|checkout|fetch|list-tags|pull|push|push-tags|remove-tag|status|tag"
+               if [ -d $version ]; then
+                       echo "Version directory ('$version') does not exist yet. Please run the 'clone' action first."
+               fi
 
        ;;
 esac