From 7470b1607bc71c7ff6e4d74cfac62c4962e19608 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Thu, 21 May 2026 16:32:37 +0200 Subject: [PATCH 1/2] Do GIT_ASKPASS at all git clone Signed-off-by: Cristian Le --- tmt/libraries/beakerlib.py | 6 +----- tmt/steps/discover/__init__.py | 6 +----- tmt/utils/git.py | 3 +++ 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/tmt/libraries/beakerlib.py b/tmt/libraries/beakerlib.py index a0df106781..669ebaf959 100644 --- a/tmt/libraries/beakerlib.py +++ b/tmt/libraries/beakerlib.py @@ -14,7 +14,7 @@ from tmt.container import container, simple_field from tmt.convert import write from tmt.steps.discover import Discover -from tmt.utils import Command, Environment, EnvVarValue, Path +from tmt.utils import Command, Path from . import Library, LibraryError @@ -363,14 +363,10 @@ def _do_fetch(self, directory: Path) -> None: else: self.parent.debug(f"Cloning '{self.identifier}' for '{self}'.", level=3) - environment = Environment.from_environ() - environment["GIT_ASKPASS"] = EnvVarValue("echo") - tmt.utils.git.git_clone( url=self.url, destination=clone_dir, shallow=self.ref is None, - environment=environment, logger=self._logger, ) self._git_clone_cache[clone_dir] = self diff --git a/tmt/steps/discover/__init__.py b/tmt/steps/discover/__init__.py index c90addb9b5..ce54147173 100644 --- a/tmt/steps/discover/__init__.py +++ b/tmt/steps/discover/__init__.py @@ -28,7 +28,7 @@ import tmt.utils.url from tmt.plugins import PluginRegistry from tmt.steps import Action -from tmt.utils import Command, Environment, EnvVarValue, GeneralError, Path +from tmt.utils import Command, GeneralError, Path def normalize_ref( @@ -285,14 +285,10 @@ def _fetch_remote_source(self, url: str) -> Optional[Path]: if self.data.url_content_type == "git": self.debug(f"Clone '{url}' to '{self.test_dir}'.") - environment = Environment.from_environ() - environment["GIT_ASKPASS"] = EnvVarValue("echo") - tmt.utils.git.git_clone( url=url, destination=self.test_dir, shallow=self.data.ref is None, - environment=environment, logger=self._logger, ) elif self.data.url_content_type == "archive": diff --git a/tmt/utils/git.py b/tmt/utils/git.py index 9979526c31..f42c3608e5 100644 --- a/tmt/utils/git.py +++ b/tmt/utils/git.py @@ -20,6 +20,7 @@ CommandOutput, Common, Environment, + EnvVarValue, GeneralError, GitUrlError, MetadataError, @@ -765,6 +766,8 @@ def git_clone( environment = environment if environment is not None else Environment.from_environ() + environment["GIT_ASKPASS"] = EnvVarValue("echo") + def clone_the_repo( url: str, destination: Path, From 4bb8f32f5469c983775f87a624ea8e45397ac135 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Thu, 21 May 2026 16:35:29 +0200 Subject: [PATCH 2/2] Drop allowing to pass `environment` to `git_clone` Signed-off-by: Cristian Le --- tmt/utils/git.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tmt/utils/git.py b/tmt/utils/git.py index f42c3608e5..22962264e2 100644 --- a/tmt/utils/git.py +++ b/tmt/utils/git.py @@ -738,7 +738,6 @@ def git_clone( destination: Path, shallow: bool = False, can_change: bool = True, - environment: Optional[Environment] = None, attempts: Optional[int] = None, interval: Optional[int] = None, timeout: Optional[int] = None, @@ -754,9 +753,6 @@ def git_clone( the whole history. :param can_change: URL can be modified with hardcoded rules. Use ``can_change=False`` to disable rewrite rules. - :param environment: if set, expose these environment variables - to the ``git clone`` command. If not set, environment of the - tmt process is used. :param attempts: Number of tries to call the function. :param interval: Amount of seconds to wait before a new try. :param timeout: Overall maximum time in seconds to clone the repo. @@ -764,8 +760,7 @@ def git_clone( :returns: Command output, bundled in a :py:class:`CommandOutput` tuple. """ - environment = environment if environment is not None else Environment.from_environ() - + environment = Environment.from_environ() environment["GIT_ASKPASS"] = EnvVarValue("echo") def clone_the_repo(