mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-09 23:10:24 +01:00
bugfix: get dump folder contents in respective output folder (#4034)
The relative path for external git directory was computed relative to the root of the repo itself, which created a relative path which is current working directory. So, all of the contents of the erepo to download was dumped in the pwd rather than inside of it's own directory. Fix #4033
This commit is contained in:
+2
-4
@@ -404,10 +404,8 @@ class RepoTree(BaseTree):
|
||||
|
||||
for root, _, files in self.walk(top):
|
||||
root = PathInfo(root)
|
||||
dest_dir = root.relative_to(top)
|
||||
makedirs(dest_dir, exist_ok=True)
|
||||
makedirs(dest, exist_ok=True)
|
||||
for fname in files:
|
||||
src = root / fname
|
||||
dest = dest_dir / fname
|
||||
with self.open(src, mode="rb") as fobj:
|
||||
copy_fobj_to_file(fobj, dest)
|
||||
copy_fobj_to_file(fobj, dest / fname)
|
||||
|
||||
@@ -33,7 +33,9 @@ def test_get_repo_dir(tmp_dir, erepo_dir):
|
||||
trees_equal(erepo_dir / "dir", "dir_imported")
|
||||
|
||||
|
||||
def test_get_git_file(tmp_dir, erepo_dir):
|
||||
@pytest.mark.parametrize("repo_type", ["git_dir", "erepo_dir"])
|
||||
def test_get_git_file(request, tmp_dir, repo_type):
|
||||
erepo_dir = request.getfixturevalue(repo_type)
|
||||
src = "some_file"
|
||||
dst = "some_file_imported"
|
||||
|
||||
@@ -45,7 +47,9 @@ def test_get_git_file(tmp_dir, erepo_dir):
|
||||
assert (tmp_dir / dst).read_text() == "hello"
|
||||
|
||||
|
||||
def test_get_git_dir(tmp_dir, erepo_dir):
|
||||
@pytest.mark.parametrize("repo_type", ["git_dir", "erepo_dir"])
|
||||
def test_get_git_dir(request, tmp_dir, repo_type):
|
||||
erepo_dir = request.getfixturevalue(repo_type)
|
||||
src = "some_directory"
|
||||
dst = "some_directory_imported"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user