Skip to content

Commit

Permalink
Checkout repo submodules recursively
Browse files Browse the repository at this point in the history
  • Loading branch information
xuzhao9 committed Sep 26, 2023
1 parent 6fef32d commit 0ecc72c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions utils/gitutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}")
Expand Down

0 comments on commit 0ecc72c

Please sign in to comment.