File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111# Pinned commits make the integration tests reproducible across upstream
1212# pushes; unpinned URLs follow upstream HEAD.
1313
14+ # Initialise any submodules of $1 (shallow, recursive). No-op when the repo
15+ # declares none. Some mods vendor shared libraries (e.g. BGforge-MLS-IElib) as
16+ # submodules, and their sources are part of the real-world corpus the
17+ # integration tests sweep.
18+ init_submodules () {
19+ local repo_dir=" $1 "
20+ if [[ -f " $repo_dir /.gitmodules" ]]; then
21+ git -C " $repo_dir " submodule update --init --recursive --depth 1 -q
22+ fi
23+ }
24+
1425# Clone each repo listed in $1 into $2.
1526# If a target directory already exists, leave its checkout alone - callers
16- # rely on this for the "already cloned" optimisation.
27+ # rely on this for the "already cloned" optimisation. Submodules are still
28+ # initialised on that path so pre-existing checkouts converge with fresh ones.
1729clone_repos () {
1830 local txt_file=" $1 "
1931 local target_dir=" $2 "
@@ -28,6 +40,7 @@ clone_repos() {
2840
2941 if [[ -d " $target_dir /$name " ]]; then
3042 echo " Already cloned: $name "
43+ init_submodules " $target_dir /$name "
3144 continue
3245 fi
3346
@@ -41,6 +54,7 @@ clone_repos() {
4154 echo " Cloning: $name (HEAD)"
4255 git clone --depth 1 -q " $url " " $target_dir /$name "
4356 fi
57+ init_submodules " $target_dir /$name "
4458 done < " $txt_file "
4559}
4660
Original file line number Diff line number Diff line change 2323for dir in " $ROOT_DIR " /external/fallout/* / " $ROOT_DIR " /external/infinity-engine/* /; do
2424 if [[ -d " $dir /.git" ]]; then
2525 git -C " $dir " checkout . 2> /dev/null || true
26+ # Submodule worktrees are separate repos; the checkout above does not
27+ # touch them, so reset each initialised one as well.
28+ git -C " $dir " submodule foreach --recursive --quiet ' git checkout . 2>/dev/null || true' 2> /dev/null || true
2629 fi
2730done
2831
You can’t perform that action at this time.
0 commit comments