Skip to content

Commit e7e5174

Browse files
committed
fix shellcheck failures of hack/cherry_pick_pull.sh
1 parent b384712 commit e7e5174

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

hack/.shellcheck_failures

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
./cluster/test-network.sh
2424
./cluster/test-smoke.sh
2525
./cluster/validate-cluster.sh
26-
./hack/cherry_pick_pull.sh
2726
./hack/ginkgo-e2e.sh
2827
./hack/grab-profiles.sh
2928
./hack/lib/init.sh

hack/cherry_pick_pull.sh

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ shift 1
8484
declare -r PULLS=( "$@" )
8585

8686
function join { local IFS="$1"; shift; echo "$*"; }
87-
declare -r PULLDASH=$(join - "${PULLS[@]/#/#}") # Generates something like "#12345-#56789"
88-
declare -r PULLSUBJ=$(join " " "${PULLS[@]/#/#}") # Generates something like "#12345 #56789"
87+
PULLDASH=$(join - "${PULLS[@]/#/#}") # Generates something like "#12345-#56789"
88+
declare -r PULLDASH
89+
PULLSUBJ=$(join " " "${PULLS[@]/#/#}") # Generates something like "#12345 #56789"
90+
declare -r PULLSUBJ
8991

9092
echo "+++ Updating remotes..."
9193
git remote update "${UPSTREAM_REMOTE}" "${FORK_REMOTE}"
@@ -96,9 +98,12 @@ if ! git log -n1 --format=%H "${BRANCH}" >/dev/null 2>&1; then
9698
exit 1
9799
fi
98100

99-
declare -r NEWBRANCHREQ="automated-cherry-pick-of-${PULLDASH}" # "Required" portion for tools.
100-
declare -r NEWBRANCH="$(echo "${NEWBRANCHREQ}-${BRANCH}" | sed 's/\//-/g')"
101-
declare -r NEWBRANCHUNIQ="${NEWBRANCH}-$(date +%s)"
101+
NEWBRANCHREQ="automated-cherry-pick-of-${PULLDASH}" # "Required" portion for tools.
102+
declare -r NEWBRANCHREQ
103+
NEWBRANCH="$(echo "${NEWBRANCHREQ}-${BRANCH}" | sed 's/\//-/g')"
104+
declare -r NEWBRANCH
105+
NEWBRANCHUNIQ="${NEWBRANCH}-$(date +%s)"
106+
declare -r NEWBRANCHUNIQ
102107
echo "+++ Creating local branch ${NEWBRANCHUNIQ}"
103108

104109
cleanbranch=""
@@ -128,7 +133,8 @@ trap return_to_kansas EXIT
128133

129134
SUBJECTS=()
130135
function make-a-pr() {
131-
local rel="$(basename "${BRANCH}")"
136+
local rel
137+
rel="$(basename "${BRANCH}")"
132138
echo
133139
echo "+++ Creating a pull request on GitHub at ${GITHUB_USER}:${NEWBRANCH}"
134140

@@ -137,7 +143,8 @@ function make-a-pr() {
137143
# when we shove the heredoc at hub directly, tickling the ioctl
138144
# crash.
139145
prtext="$(mktemp -t prtext.XXXX)" # cleaned in return_to_kansas
140-
local numandtitle=$(printf '%s\n' "${SUBJECTS[@]}")
146+
local numandtitle
147+
numandtitle=$(printf '%s\n' "${SUBJECTS[@]}")
141148
cat >"${prtext}" <<EOF
142149
Automated cherry pick of ${numandtitle}
143150
@@ -218,7 +225,7 @@ if [[ -n "${DRY_RUN}" ]]; then
218225
exit 0
219226
fi
220227

221-
if git remote -v | grep ^${FORK_REMOTE} | grep ${MAIN_REPO_ORG}/${MAIN_REPO_NAME}.git; then
228+
if git remote -v | grep ^"${FORK_REMOTE}" | grep "${MAIN_REPO_ORG}/${MAIN_REPO_NAME}.git"; then
222229
echo "!!! You have ${FORK_REMOTE} configured as your ${MAIN_REPO_ORG}/${MAIN_REPO_NAME}.git"
223230
echo "This isn't normal. Leaving you with push instructions:"
224231
echo

0 commit comments

Comments
 (0)