Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reference argument to submodule update --init invocations #842

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions edk2toolext/environment/repo_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,9 @@
"""
details = repo_details(abs_file_system_path)
with Repo(abs_file_system_path) as repo:
reference = None
if "ReferencePath" in dep and os.path.exists(dep["ReferencePath"]):
reference = Path(dep["ReferencePath"])

Check warning on line 393 in edk2toolext/environment/repo_resolver.py

View check run for this annotation

Codecov / codecov/patch

edk2toolext/environment/repo_resolver.py#L393

Added line #L393 was not covered by tests
if "Commit" in dep:
commit = dep["Commit"]
if update_ok or force:
Expand All @@ -397,7 +400,10 @@
except GitCommandError:
repo.git.fetch()
repo.git.checkout(commit)
repo.git.submodule("update", "--init", "--recursive")
if reference:
repo.git.submodule("update", "--init", "--recursive", "--reference", reference.as_posix())

Check warning on line 404 in edk2toolext/environment/repo_resolver.py

View check run for this annotation

Codecov / codecov/patch

edk2toolext/environment/repo_resolver.py#L404

Added line #L404 was not covered by tests
else:
repo.git.submodule("update", "--init", "--recursive")
else:
head = details["Head"]
if commit in [head["HexSha"], head["HexShaShort"]]:
Expand Down Expand Up @@ -427,7 +433,10 @@
repo.remotes.origin.config_writer.set_value("fetch", refspec).release()
repo.git.fetch()
repo.git.checkout(branch)
repo.git.submodule("update", "--init", "--recursive")
if reference:
repo.git.submodule("update", "--init", "--recursive", "--reference", reference.as_posix())

Check warning on line 437 in edk2toolext/environment/repo_resolver.py

View check run for this annotation

Codecov / codecov/patch

edk2toolext/environment/repo_resolver.py#L437

Added line #L437 was not covered by tests
else:
repo.git.submodule("update", "--init", "--recursive")
else:
if details["Branch"] == dep["Branch"]:
logger.debug(
Expand Down