diff --git a/dvc/dependency/repo.py b/dvc/dependency/repo.py index 91959caa9f..5bb6d98313 100644 --- a/dvc/dependency/repo.py +++ b/dvc/dependency/repo.py @@ -83,6 +83,7 @@ def _make_fs( url=self.def_repo[self.PARAM_URL], rev=rev or self._get_rev(locked=locked), subrepos=True, + config={"cache": {"dir": self.repo.cache.local.path}}, ) def _get_rev(self, locked: bool = True): diff --git a/dvc/repo/open_repo.py b/dvc/repo/open_repo.py index b7ce7a7982..f2237a9c6a 100644 --- a/dvc/repo/open_repo.py +++ b/dvc/repo/open_repo.py @@ -68,6 +68,9 @@ def open_repo(url, *args, **kwargs): if os.path.exists(url): try: + config = _get_remote_config(url) + config.update(kwargs.get("config") or {}) + kwargs["config"] = config return Repo(url, *args, **kwargs) except NotDvcRepoError: pass # fallthrough to _external_repo diff --git a/tests/unit/stage/test_stage.py b/tests/unit/stage/test_stage.py index 739527ae95..bec4a5a546 100644 --- a/tests/unit/stage/test_stage.py +++ b/tests/unit/stage/test_stage.py @@ -56,7 +56,8 @@ def test_path_conversion(dvc): def test_stage_update(dvc, mocker): - dep = RepoDependency({"url": "example.com"}, None, "dep_path") + stage = Stage(dvc, "path", "cmd") + dep = RepoDependency({"url": "example.com"}, stage, "dep_path") mocker.patch.object(dep, "update", return_value=None) stage = Stage(dvc, "path", deps=[dep])