Skip to content

Commit

Permalink
import: don't forget to set cache.dir (#9415)
Browse files Browse the repository at this point in the history
* import: don't forget to set cache.dir

* repo: open: try setting remote for local repos
  • Loading branch information
efiop authored May 7, 2023
1 parent ad39bf1 commit 967dd5e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions dvc/dependency/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions dvc/repo/open_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/stage/test_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit 967dd5e

Please sign in to comment.