From 980d8ea3f8929655d0f135cde0f788b30ed558dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Wed, 2 Dec 2015 22:53:00 +0100 Subject: [PATCH] switch_all_submodules_to_head_and_clean: Add support to clone from mirror MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- switch_all_submodules_to_head_and_clean | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/switch_all_submodules_to_head_and_clean b/switch_all_submodules_to_head_and_clean index e41f550..3aaec01 100755 --- a/switch_all_submodules_to_head_and_clean +++ b/switch_all_submodules_to_head_and_clean @@ -56,6 +56,14 @@ if [[ -e .gitmodules ]]; then else sed -i "s/system@/$gituser@/g" .gitmodules fi + REPO_URL=$(git config --get remote.origin.url |\ + sed "s|\(https\?\)://\([^@]*@\)\?\(.*\)/[^/]*$|\3|") + REPO_PROTO=$(git config --get remote.origin.url |\ + 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" .gitmodules + fi git submodule init git submodule update