Browse Source

Update switch_all_submodules_to_head_and_clean:

+ add support for cloning repositories via ssh

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/1/head
Slávek Banko 4 years ago
parent
commit
f50efa7e80
  1. 8
      switch_all_submodules_to_head_and_clean

8
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

Loading…
Cancel
Save