From e7e517434bea6dd3c62abd40f2696d8794e85a67 Mon Sep 17 00:00:00 2001 From: SataQiu Date: Sat, 20 Apr 2019 15:49:34 +0800 Subject: [PATCH] fix shellcheck failures of hack/cherry_pick_pull.sh --- hack/.shellcheck_failures | 1 - hack/cherry_pick_pull.sh | 23 +++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/hack/.shellcheck_failures b/hack/.shellcheck_failures index 55ef10e6d6..94ee645267 100644 --- a/hack/.shellcheck_failures +++ b/hack/.shellcheck_failures @@ -23,7 +23,6 @@ ./cluster/test-network.sh ./cluster/test-smoke.sh ./cluster/validate-cluster.sh -./hack/cherry_pick_pull.sh ./hack/ginkgo-e2e.sh ./hack/grab-profiles.sh ./hack/lib/init.sh diff --git a/hack/cherry_pick_pull.sh b/hack/cherry_pick_pull.sh index ee3ea13c10..8be1c106ed 100755 --- a/hack/cherry_pick_pull.sh +++ b/hack/cherry_pick_pull.sh @@ -84,8 +84,10 @@ shift 1 declare -r PULLS=( "$@" ) function join { local IFS="$1"; shift; echo "$*"; } -declare -r PULLDASH=$(join - "${PULLS[@]/#/#}") # Generates something like "#12345-#56789" -declare -r PULLSUBJ=$(join " " "${PULLS[@]/#/#}") # Generates something like "#12345 #56789" +PULLDASH=$(join - "${PULLS[@]/#/#}") # Generates something like "#12345-#56789" +declare -r PULLDASH +PULLSUBJ=$(join " " "${PULLS[@]/#/#}") # Generates something like "#12345 #56789" +declare -r PULLSUBJ echo "+++ Updating remotes..." git remote update "${UPSTREAM_REMOTE}" "${FORK_REMOTE}" @@ -96,9 +98,12 @@ if ! git log -n1 --format=%H "${BRANCH}" >/dev/null 2>&1; then exit 1 fi -declare -r NEWBRANCHREQ="automated-cherry-pick-of-${PULLDASH}" # "Required" portion for tools. -declare -r NEWBRANCH="$(echo "${NEWBRANCHREQ}-${BRANCH}" | sed 's/\//-/g')" -declare -r NEWBRANCHUNIQ="${NEWBRANCH}-$(date +%s)" +NEWBRANCHREQ="automated-cherry-pick-of-${PULLDASH}" # "Required" portion for tools. +declare -r NEWBRANCHREQ +NEWBRANCH="$(echo "${NEWBRANCHREQ}-${BRANCH}" | sed 's/\//-/g')" +declare -r NEWBRANCH +NEWBRANCHUNIQ="${NEWBRANCH}-$(date +%s)" +declare -r NEWBRANCHUNIQ echo "+++ Creating local branch ${NEWBRANCHUNIQ}" cleanbranch="" @@ -128,7 +133,8 @@ trap return_to_kansas EXIT SUBJECTS=() function make-a-pr() { - local rel="$(basename "${BRANCH}")" + local rel + rel="$(basename "${BRANCH}")" echo echo "+++ Creating a pull request on GitHub at ${GITHUB_USER}:${NEWBRANCH}" @@ -137,7 +143,8 @@ function make-a-pr() { # when we shove the heredoc at hub directly, tickling the ioctl # crash. prtext="$(mktemp -t prtext.XXXX)" # cleaned in return_to_kansas - local numandtitle=$(printf '%s\n' "${SUBJECTS[@]}") + local numandtitle + numandtitle=$(printf '%s\n' "${SUBJECTS[@]}") cat >"${prtext}" <