fix source deployments to initialize submodules

This commit is contained in:
lda
2026-07-16 18:43:33 +07:00 Verified
parent b459019085
commit 9a14410bed
+11
View File
@@ -110,6 +110,16 @@ update_existing_repo() {
git -C "$repo_dir" pull --ff-only origin "$ref" || fail 'git pull --ff-only failed' git -C "$repo_dir" pull --ff-only origin "$ref" || fail 'git pull --ff-only failed'
} }
update_submodules() {
repo_dir=$1
# Sync first so an updated .gitmodules URL is honored by an existing
# checkout, then initialize and pin every nested submodule to the commit
# recorded by the parent repository.
git -C "$repo_dir" submodule sync --recursive || fail 'git submodule sync failed'
git -C "$repo_dir" submodule update --init --recursive || fail 'git submodule update failed'
}
install_executable_force() { install_executable_force() {
src=$1 src=$1
dst=$2 dst=$2
@@ -186,6 +196,7 @@ main() {
git clone --depth 1 --branch "$REF" "$REPO_URL" "$WORKDIR" || git clone --depth 1 --branch "$REF" "$REPO_URL" "$WORKDIR" ||
fail 'git clone failed' fail 'git clone failed'
fi fi
update_submodules "$WORKDIR"
cd "$WORKDIR" cd "$WORKDIR"