You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metron.apache.org by GitBox <gi...@apache.org> on 2019/01/15 14:11:54 UTC
[GitHub] JonZeolla commented on a change in pull request #1315: METRON-1956
add missing tests and some of the many shellcheck fixes
JonZeolla commented on a change in pull request #1315: METRON-1956 add missing tests and some of the many shellcheck fixes
URL: https://github.com/apache/metron/pull/1315#discussion_r247904302
##########
File path: dev-utilities/committer-utils/metron-committer-common
##########
@@ -172,27 +172,27 @@ function setup_working_directory {
#
function setup_code {
# if working directory does not exist, checkout the base branch
- if [ ! -d "$WORK" ]; then
+ if [[ ! -d "$WORK" ]]; then
REPO_NAME="metron"
- if [ -n $1 ]; then
+ if [[ -n $1 ]]; then
REPO_NAME=$1
fi
# origin repository
ORIGIN="https://github.com/apache/${REPO_NAME}"
read -p " origin repo [$ORIGIN]: " INPUT
- [ -n "$INPUT" ] && ORIGIN=${INPUT}
+ [[ -n "$INPUT" ]] && ORIGIN=${INPUT}
# what branch did the PR get submitted against? could be a feature branch
- BASE_BRANCH=`curl -s https://api.github.com/repos/apache/${REPO_NAME}/pulls/${PR} | python -c 'import sys, json; print json.load(sys.stdin)["base"]["ref"]'`
+ BASE_BRANCH=$(curl -s https://api.github.com/repos/apache/${REPO_NAME}/pulls/${PR} | python -c 'import sys, json; print json.load(sys.stdin)["base"]["ref"]')
read -p " base branch to merge into [$BASE_BRANCH]: " INPUT
- [ -n "$INPUT" ] && BASE_BRANCH=${INPUT}
+ [[ -n "$INPUT" ]] && BASE_BRANCH=${INPUT}
# clone the repository and fetch updates
mkdir -p ${WORK}
git clone ${ORIGIN} ${WORK}
- cd ${WORK} || exit "Failed to cd to ${WORK}"
+ cd ${WORK} &> /dev/null || echo "failed to change directory to ${WORK}" && exit 1
Review comment:
I think what you actually want is:
```bash
cd ${WORK} &> /dev/null || { echo "failed to change directory to ${WORK}" ; exit 1 }
```
Regardless of the success of the `echo`, you want to `exit 1`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services