From 21db47a309bc35b7dfea6ec5ab2adea8c146c869 Mon Sep 17 00:00:00 2001 From: Zach Loafman Date: Mon, 12 Oct 2015 13:22:20 -0700 Subject: [PATCH] Fix cherry_pick_pull.sh to workaround hub#976 A number of people have run across https://github.com/github/hub/issues/976 when trying to do cherry picks using this script. Rather than stealing stdin, just create a tmpfile and give hub full access to stdin, which will let it prompt for the password it so dearly wants. Tested by being unauth'd. --- hack/cherry_pick_pull.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/hack/cherry_pick_pull.sh b/hack/cherry_pick_pull.sh index 5ab230d4a7..89d71fb8a6 100755 --- a/hack/cherry_pick_pull.sh +++ b/hack/cherry_pick_pull.sh @@ -76,11 +76,12 @@ if ! git log -n1 --format=%H "${BRANCH}" >/dev/null 2>&1; then fi declare -r NEWBRANCHREQ="automated-cherry-pick-of-${PULLDASH}" # "Required" portion for tools. -declare -r NEWBRANCH="$(echo ${NEWBRANCHREQ}-${BRANCH} | sed 's/\//-/g')" +declare -r NEWBRANCH="$(echo "${NEWBRANCHREQ}-${BRANCH}" | sed 's/\//-/g')" declare -r NEWBRANCHUNIQ="${NEWBRANCH}-$(date +%s)" echo "+++ Creating local branch ${NEWBRANCHUNIQ}" cleanbranch="" +prtext="" gitamcleanup=false function return_to_kansas { echo "" @@ -92,6 +93,9 @@ function return_to_kansas { if [[ -n "${cleanbranch}" ]]; then git branch -D "${cleanbranch}" >/dev/null 2>&1 || true fi + if [[ -n "${prtext}" ]]; then + rm "${prtext}" + fi } trap return_to_kansas EXIT @@ -134,13 +138,21 @@ done gitamcleanup=false function make-a-pr() { - local rel=$(basename ${BRANCH}) + local rel="$(basename "${BRANCH}")" echo "+++ Creating a pull request on github" - hub pull-request -F- -h "${GITHUB_USER}:${NEWBRANCH}" -b "kubernetes:${rel}" <"${prtext}" <