From 9be6e5e6f0f6396ac1922247a0718aadcadafe06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Thu, 9 Aug 2018 15:12:07 +0200 Subject: [PATCH] Update switch_all_submodules_to_head_and_clean: + add support for cloning repositories via ssh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko (cherry picked from commit f50efa7e809717d7c1c700eff7223da847f688e3) --- switch_all_submodules_to_head_and_clean | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/switch_all_submodules_to_head_and_clean b/switch_all_submodules_to_head_and_clean index b41a392..c3fbde6 100755 --- a/switch_all_submodules_to_head_and_clean +++ b/switch_all_submodules_to_head_and_clean @@ -31,7 +31,7 @@ fi # get git user echobd "Preparing $(git rev-parse --show-toplevel | xargs -r basename) $branch branch for development use" if [[ $1 == "" ]]; then - gituser=`git config --local remote.origin.url | sed -n "s/https\?:\/\/\([^@]*\)@.*/\1/p" | grep -v "\(anonymous\|system\)"` + gituser=`git config --local remote.origin.url | sed -n "s|\(https\?://\)\?\([^@]*\)@.*|\2|p" | grep -v "\(anonymous\|system\)"` else gituser=$1 fi @@ -81,12 +81,12 @@ updateModule() { sed -i "s/system@/$gituser@/g" $PARENTDIR/$MODULE.gitmodules fi REPO_URL=$(git config --get remote.origin.url |\ - sed "s|\(https\?\)://\([^@]*@\)\?\(.*\)/[^/]*$|\3|") + sed "s|\(https\?://\)\?\([^@]*@\)\?\(.*\)/[^/]*$|\3|") REPO_PROTO=$(git config --get remote.origin.url |\ - sed "s|\(https\?\)://\([^@]*@\)\?\(.*\)/[^/]*$|\1|") + sed "s|\(https\?://\)\?\([^@]*@\)\?\(.*\)/[^/]*$|\1|") REPO_MASTER=scm.trinitydesktop.org/scm/git if [[ "$REPO_URL" != "$REPO_MASTER" ]]; then - sed -i "s#https\?://\([^@]*@\)\?$REPO_MASTER#$REPO_PROTO://\1$REPO_URL#g" $PARENTDIR/$MODULE.gitmodules + sed -i "s#https\?://\([^@]*@\)\?$REPO_MASTER#$REPO_PROTO\1$REPO_URL#g" $PARENTDIR/$MODULE.gitmodules fi sed -n "s|^\[submodule \"\([^\"]*\)\"\]$|\1|p" <$PARENTDIR/$MODULE.gitmodules |\ while read submodule; do