From 02e4074ec124f09471c506f77788204509f11760 Mon Sep 17 00:00:00 2001 From: imuge Date: Fri, 13 Nov 2020 15:14:28 +0800 Subject: [PATCH 1/2] Update repo.sh Fix remote config error in the first time. --- build/repo.sh | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/build/repo.sh b/build/repo.sh index 56aac1d5..545289a8 100755 --- a/build/repo.sh +++ b/build/repo.sh @@ -1,4 +1,3 @@ - #调用当前脚本目录下 env.sh 脚本,设置环境变量,处理当前传入参数; if [ ! $ENV_SHELL ] then @@ -85,24 +84,6 @@ git config remote.origin.pushurl $REMOTE_ORIGIN_URL echo "远程仓库的地址更新为:"$REMOTE_ORIGIN_URL echo "" -#同步更新子模块的远程仓库 origin 的地址; -echo "---------------- 更新子模块的远程仓库地址 ----------------" -# 子模块名称列表; - -SUBMODULES=$(git submodule | awk '{print $2}') -for m in $SUBMODULES; -do - SUBMODULE_URL=$(git config --get submodule.$m.url) - echo "模块[$m].URL="$SUBMODULE_URL - - cd $BASE_DIR/$m - - git config remote.origin.url $SUBMODULE_URL - git config remote.origin.pushurl $SUBMODULE_URL - - cd $BASE_DIR -done - #检查是否要跳过子模块更新环节; if [ $SKIP_SUBMODULES_UPDATE == 1 ] then From 50068fdde03db1188d3b405011998f774138c299 Mon Sep 17 00:00:00 2001 From: imuge Date: Fri, 13 Nov 2020 15:47:50 +0800 Subject: [PATCH 2/2] Update repo.sh --- build/repo.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/build/repo.sh b/build/repo.sh index 545289a8..d3a12ab3 100755 --- a/build/repo.sh +++ b/build/repo.sh @@ -84,6 +84,28 @@ git config remote.origin.pushurl $REMOTE_ORIGIN_URL echo "远程仓库的地址更新为:"$REMOTE_ORIGIN_URL echo "" +#同步更新子模块的远程仓库 origin 的地址; +echo "---------------- 更新子模块的远程仓库地址 ----------------" +# 子模块名称列表; + +SUBMODULES=$(git submodule | awk '{print $2}') +for m in $SUBMODULES; +do + SUBMODULE_URL=$(git config --get submodule.$m.url) + echo "模块[$m].URL="$SUBMODULE_URL + + cd $BASE_DIR/$m + + git config remote.origin.url $SUBMODULE_URL + git config remote.origin.pushurl $SUBMODULE_URL + + cd $BASE_DIR +done + +#首次执行同步更新子模块的远程仓库 origin 的地址会将主项目地址更改,以下操作确保主项目远程仓库地址正确 +git config remote.origin.url $REMOTE_ORIGIN_URL +git config remote.origin.pushurl $REMOTE_ORIGIN_URL + #检查是否要跳过子模块更新环节; if [ $SKIP_SUBMODULES_UPDATE == 1 ] then