Skip to content

Commit

Permalink
Checkout repo submodules recursively (#1937)
Browse files Browse the repository at this point in the history
Summary:
In bisection workflow, we found sometimes it fails to checkout recursive modules with `git checkout --recurse-submodules`, so we are adding another `git submodule update --init --recursive` command to make sure all submodules are being checked out.

Failed example workflow: https://github.com/pytorch/benchmark/actions/runs/6104757433

Success workflow: https://github.com/pytorch/benchmark/actions/runs/6313591947/job/17141994764

Pull Request resolved: #1937

Reviewed By: atalman

Differential Revision: D49639212

Pulled By: xuzhao9

fbshipit-source-id: 376947e38e4a85e7bdbbbdd14632632e2b505cbd
  • Loading branch information
xuzhao9 authored and facebook-github-bot committed Sep 26, 2023
1 parent 6fef32d commit 64409d5
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 64409d5

Please sign in to comment.