tolerate both http(s) and git urls for cherry_pick_pull

Looks like the previous change broke for users who have cloned their
upstream using https instead of ssh. Here we explicit strip out the
prefixes like "http://", "https://" and "git@" before look for the repo
name and the org name.

Change-Id: I8fbfae8bfa209a954d36d3ada791dcf13070ec6d
pull/58/head
Davanum Srinivas 2018-10-15 21:05:23 -04:00
parent f6b54f79fb
commit 0b15620ea3
No known key found for this signature in database
GPG Key ID: 80D83A796103BF59
1 changed files with 2 additions and 2 deletions

View File

@ -34,8 +34,8 @@ DRY_RUN=${DRY_RUN:-""}
REGENERATE_DOCS=${REGENERATE_DOCS:-""}
UPSTREAM_REMOTE=${UPSTREAM_REMOTE:-upstream}
FORK_REMOTE=${FORK_REMOTE:-origin}
MAIN_REPO_ORG=${MAIN_REPO_ORG:-$(git remote get-url "$UPSTREAM_REMOTE" | awk -F'[@:./]' 'NR==1{print $4}')}
MAIN_REPO_NAME=${MAIN_REPO_NAME:-$(git remote get-url "$UPSTREAM_REMOTE" | awk -F'[@:./]' 'NR==1{print $5}')}
MAIN_REPO_ORG=${MAIN_REPO_ORG:-$(git remote get-url "$UPSTREAM_REMOTE" | awk '{gsub(/http[s]:\/\/|git@/,"")}1' | awk -F'[@:./]' 'NR==1{print $3}')}
MAIN_REPO_NAME=${MAIN_REPO_NAME:-$(git remote get-url "$UPSTREAM_REMOTE" | awk '{gsub(/http[s]:\/\/|git@/,"")}1' | awk -F'[@:./]' 'NR==1{print $4}')}
if [[ -z ${GITHUB_USER:-} ]]; then
echo "Please export GITHUB_USER=<your-user> (or GH organization, if that's where your fork lives)"