Fix setting branch on submodules
This commit is contained in:
parent
63d8785da5
commit
34a00e5576
7
ctctl
7
ctctl
|
@ -475,7 +475,12 @@ ctctl_add_submodule(){
|
|||
git submodule add --branch ${BRANCH} --name ${MODULE} --force ${URL} ${DIR}/${NAME}
|
||||
else
|
||||
echo "Updating ${MODULE} submodule from ${URL} (branch ${BRANCH})"
|
||||
git submodule set-branch --branch ${BRANCH} ${DIR}/${NAME}
|
||||
# Get the git top-level, then compare with $(pwd) to get the correct relative path of the bundle,
|
||||
# from the git parent root point of view (not from $(pwd))
|
||||
local GIT_ROOT=$(git rev-parse --show-toplevel)
|
||||
local CURRENT_DIR=$(pwd)
|
||||
local MODULE_REL_DIR=$(echo ${CURRENT_DIR} | sed -E "s|^${GIT_ROOT}/||")
|
||||
git submodule set-branch --branch ${BRANCH} -- ${MODULE_REL_DIR}/${DIR}/${NAME}
|
||||
fi
|
||||
git submodule update --init --recursive --remote --merge ${DIR}/${NAME}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue