Skip to content

Commit

Permalink
fixes iterative#8705 issue
Browse files Browse the repository at this point in the history
  • Loading branch information
karanjakhar committed Feb 13, 2023
1 parent d0c6cd7 commit 72f2ee3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
9 changes: 8 additions & 1 deletion dvc/cachemgr.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dvc.fs import GitFileSystem, Schemes
from dvc.fs import GitFileSystem, LocalFileSystem, Schemes
from dvc_data.hashfile.db import get_odb


Expand All @@ -11,6 +11,13 @@ def _get_odb(repo, settings, fs=None):
cls, config, fs_path = get_cloud_fs(repo, **settings)
config["tmp_dir"] = repo.tmp_dir
fs = fs or cls(**config)

if (
isinstance(repo.fs, GitFileSystem)
and isinstance(fs, LocalFileSystem)
and fs_path[:-10] == "/"
):
fs_path = fs.path.join(repo.abs_root_dir, fs_path[1:])
return get_odb(fs, fs_path, state=repo.state, **config)


Expand Down
7 changes: 7 additions & 0 deletions dvc/repo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ def __init__(
self._fs = fs or localfs
self._scm = scm

self.abs_root_dir, _, _ = self._get_repo_dirs(
root_dir=root_dir,
fs=self.fs,
uninitialized=uninitialized,
scm=scm,
)

if rev and not fs:
self._scm = scm = SCM(root_dir or os.curdir)
root_dir = "/"
Expand Down

0 comments on commit 72f2ee3

Please sign in to comment.