Copilot commented on code in PR #62938:
URL: https://github.com/apache/airflow/pull/62938#discussion_r3066479884
##########
providers/git/src/airflow/providers/git/bundles/git.py:
##########
@@ -301,8 +301,12 @@ def _fetch_bare_repo(self):
)
def _fetch_submodules(self) -> None:
self._log.info("Initializing and updating submodules",
repo_path=self.repo_path)
- self.repo.git.submodule("sync", "--recursive")
- self.repo.git.submodule("update", "--init", "--recursive", "--jobs",
"1")
+ cm = nullcontext()
+ if self.hook and (cmd := self.hook.env.get("GIT_SSH_COMMAND")):
+ cm = self.repo.git.custom_environment(GIT_SSH_COMMAND=cmd)
+ with cm:
+ self.repo.git.submodule("sync", "--recursive")
+ self.repo.git.submodule("update", "--init", "--recursive",
"--jobs", "1")
Review Comment:
The new submodule fetch behavior relies on setting `GIT_SSH_COMMAND` via
`Repo.git.custom_environment(...)`, but the existing unit tests only assert
that `submodule sync/update` are invoked and do not verify that the SSH
environment is applied. Please add a regression test that sets
`mock_githook.return_value.env = {"GIT_SSH_COMMAND": "..."}` and asserts
`mock_repo_instance.git.custom_environment` is entered (and that submodule
commands run within that context), so private submodule authentication is
actually covered.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]