Update release scripts for branches
[policy/parent.git] / integration / src / release_scripts / generateCommit.sh
index 8c21c30..29e600a 100755 (executable)
@@ -22,7 +22,7 @@
 
 set -e
 
-SCRIPT_NAME=`basename $0`
+SCRIPT_NAME=$(basename "$0")
 repo_location="./"
 
 usage()
@@ -47,13 +47,6 @@ usage()
     exit 255;
 }
 
-update_parent=false
-update_common=false
-update_models=false
-update_drools_pdp=false
-update_snapshot=false
-update_docker=false
-
 while getopts "hl:r:i:e:m:" opt
 do
     case $opt in
@@ -129,7 +122,7 @@ then
     exit 1
 fi
 
-git -C $repo_location/$specified_repo status | grep '^Your branch is up to date' > /dev/null 2>&1
+git -C "$repo_location/$specified_repo" status | grep '^Your branch is up to date' > /dev/null 2>&1
 return_code=$?
 
 if [ $return_code -eq 0 ]
@@ -137,30 +130,32 @@ then
     echo "generating commit '$commit_header' . . ."
 
     commit_msg_temp_file=$(mktemp)
-    echo "$commit_header"                                           > $commit_msg_temp_file
-    echo ""                                                        >> $commit_msg_temp_file
-    echo "$commit_message"                                         >> $commit_msg_temp_file
-    echo ""                                                        >> $commit_msg_temp_file
-    echo "*** This commit is generated by a PF release script ***" >> $commit_msg_temp_file
-    echo ""                                                        >> $commit_msg_temp_file
-    echo "Issue-ID: $issue_id"                                     >> $commit_msg_temp_file
-
-    git -C $repo_location/$specified_repo add .
-    git -C $repo_location/$specified_repo commit -s -F "$commit_msg_temp_file"
-    rm $commit_msg_temp_file
+    {
+        echo "$commit_header"
+        echo ""
+        echo "$commit_message"
+        echo ""
+        echo "*** This commit is generated by a PF release script ***"
+        echo ""
+        echo "Issue-ID: $issue_id"
+    } > "$commit_msg_temp_file"
+
+    git -C "$repo_location/$specified_repo" add .
+    git -C "$repo_location/$specified_repo" commit -s -F "$commit_msg_temp_file"
+    rm "$commit_msg_temp_file"
 
     echo "commit '$commit_header' generated"
 else
     echo "updating commit '$commit_header' . . ."
 
-    git -C $repo_location/$specified_repo add .
-    git -C $repo_location/$specified_repo commit -as --amend --no-edit
+    git -C "$repo_location/$specified_repo" add .
+    git -C "$repo_location/$specified_repo" commit -as --amend --no-edit
 
     echo "commit '$commit_header' updated"
 fi
 
 echo "sending commit '$commit_header' to gerrit . . ."
-git -C $repo_location/$specified_repo review
+git -C "$repo_location/$specified_repo" review
 echo "commit '$commit_header' sent to gerrit . . ."