[oe-commits] [openembedded-core] 08/16: scripts/create-pull-request: improve handling of non-SSH remote URLs

git at git.openembedded.org git at git.openembedded.org
Mon Jul 29 22:47:32 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 675e88e6e0bbd5ab2dcd4bdf97b0de59925a1be6
Author: Paul Eggleton <paul.eggleton at linux.intel.com>
AuthorDate: Tue Jul 30 09:54:42 2019 +1200

    scripts/create-pull-request: improve handling of non-SSH remote URLs
    
    When attempting to create a pull request, we look at the remote URL in
    order to extract information to include in the cover letter. However,
    the assumption was that the remote is an SSH URL i.e. containing '@'
    which is not always the case (the pull and push URLs might be different,
    or we might be pushing via https) - if it wasn't the script just gave up
    leaving you to manually edit the URLs in the email. With a few minor
    tweaks to the regexes the script will work for these cases as well.
    
    Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 scripts/create-pull-request | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/scripts/create-pull-request b/scripts/create-pull-request
index 3ce03d6..762828f 100755
--- a/scripts/create-pull-request
+++ b/scripts/create-pull-request
@@ -123,20 +123,12 @@ fi
 
 # Rewrite private URLs to public URLs
 # Determine the repository name for use in the WEB_URL later
-case "$REMOTE_URL" in
-*@*)
-	USER_RE="[A-Za-z0-9_.@][A-Za-z0-9_. at -]*\$\?"
-	PROTO_RE="[a-z][a-z+]*://"
-	GIT_RE="\(^\($PROTO_RE\)\?$USER_RE@\)\([^:/]*\)[:/]\(.*\)"
-	REMOTE_URL=${REMOTE_URL%.git}
-	REMOTE_REPO=$(echo $REMOTE_URL | sed "s#$GIT_RE#\4#")
-	REMOTE_URL=$(echo $REMOTE_URL | sed "s#$GIT_RE#git://\3/\4#")
-	;;
-*)
-	echo "WARNING: Unrecognized remote URL: $REMOTE_URL"
-	echo "         The pull and browse URLs will likely be incorrect"
-	;;
-esac
+USER_RE="[A-Za-z0-9_.@][A-Za-z0-9_. at -]*\$\?"
+PROTO_RE="[a-z][a-z+]*://"
+GIT_RE="\(^\($PROTO_RE\)\?\)\($USER_RE@\)\?\([^:/]*\)[:/]\(.*\)"
+REMOTE_URL=${REMOTE_URL%.git}
+REMOTE_REPO=$(echo $REMOTE_URL | sed "s#$GIT_RE#\5#")
+REMOTE_URL=$(echo $REMOTE_URL | sed "s#$GIT_RE#git://\4/\5#")
 
 if [ -z "$BRANCH" ]; then
 	BRANCH=$(git branch | grep -e "^\* " | cut -d' ' -f2)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list