@@ -233,6 +233,7 @@ class GitLocalRepo:
233233 """A git repository."""
234234
235235 METADATA_DIR = ".git"
236+ GIT_MODULES_FILE = ".gitmodules"
236237
237238 def __init__ (self , path : str | Path = "." ) -> None :
238239 """Create a local git repo."""
@@ -258,7 +259,7 @@ def checkout_version( # pylint: disable=too-many-arguments
258259 src : str | None = None ,
259260 must_keeps : list [str ] | None = None ,
260261 ignore : Sequence [str ] | None = None ,
261- ) -> str :
262+ ) -> tuple [ str , list [ Submodule ]] :
262263 """Checkout a specific version from a given remote.
263264
264265 Args:
@@ -295,6 +296,14 @@ def checkout_version( # pylint: disable=too-many-arguments
295296 )
296297 run_on_cmdline (logger , ["git" , "reset" , "--hard" , "FETCH_HEAD" ])
297298
299+ run_on_cmdline (
300+ logger ,
301+ ["git" , "submodule" , "update" , "--init" , "--recursive" ],
302+ env = _extend_env_for_non_interactive_mode (),
303+ )
304+
305+ submodules = self .submodules ()
306+
298307 current_sha = (
299308 run_on_cmdline (logger , ["git" , "rev-parse" , "HEAD" ])
300309 .stdout .decode ()
@@ -304,7 +313,7 @@ def checkout_version( # pylint: disable=too-many-arguments
304313 if src :
305314 self .move_src_folder_up (remote , src )
306315
307- return str (current_sha )
316+ return str (current_sha ), submodules
308317
309318 def move_src_folder_up (self , remote : str , src : str ) -> None :
310319 """Move the files from the src folder into the root of the project.
0 commit comments