From 0ecc72c511119cd3e0e05e9f03e4edd3fc354a97 Mon Sep 17 00:00:00 2001 From: Xu Zhao Date: Tue, 26 Sep 2023 09:42:15 -0400 Subject: [PATCH] Checkout repo submodules recursively --- utils/gitutils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/gitutils.py b/utils/gitutils.py index 6f40039a6b..8f26f2f9c5 100644 --- a/utils/gitutils.py +++ b/utils/gitutils.py @@ -137,6 +137,8 @@ def checkout_git_commit(repo: str, commit: str) -> bool: cleanup_local_changes(repo) command = ["git", "checkout", "--recurse-submodules", commit] subprocess.check_call(command, cwd=repo, shell=False) + command = ["git", "submodule", "update", "--init", "--recursive"] + subprocess.check_call(command, cwd=repo, shell=False) return True except subprocess.CalledProcessError: # Sleep 5 seconds for concurrent git process, remove the index.lock file if exists, and try again @@ -148,6 +150,8 @@ def checkout_git_commit(repo: str, commit: str) -> bool: cleanup_local_changes(repo) command = ["git", "checkout", "--recurse-submodules", commit] subprocess.check_call(command, cwd=repo, shell=False) + command = ["git", "submodule", "update", "--init", "--recursive"] + subprocess.check_call(command, cwd=repo, shell=False) return True except subprocess.CalledProcessError: print(f"Failed to checkout commit {commit} in repo {repo}")