diff --git a/dvc/output/base.py b/dvc/output/base.py index be250f112..30565d218 100644 --- a/dvc/output/base.py +++ b/dvc/output/base.py @@ -475,7 +475,7 @@ class BaseOutput: return 0 return ilen( - filter_info.isin_or_eq(self.path_info / relpath) + filter_info.isin_or_eq(self.path_info.joinpath(*relpath)) for relpath, _ in self.hash_info.dir_info.items() ) diff --git a/tests/func/test_data_cloud.py b/tests/func/test_data_cloud.py index 92021c8ce..a0ab15032 100644 --- a/tests/func/test_data_cloud.py +++ b/tests/func/test_data_cloud.py @@ -537,3 +537,13 @@ def test_push_pull_fetch_pipeline_stages(tmp_dir, dvc, run_copy, local_remote): dvc.fetch("copy-foo-bar") assert len(recurse_list_dir(dvc.odb.local.cache_dir)) == 1 + + +def test_pull_partial(tmp_dir, dvc, local_remote): + tmp_dir.dvc_gen({"foo": {"bar": {"baz": "baz"}, "spam": "spam"}}) + dvc.push() + clean(["foo"], dvc) + + stats = dvc.pull(os.path.join("foo", "bar")) + assert stats["fetched"] == 1 + assert (tmp_dir / "foo").read_text() == {"bar": {"baz": "baz"}}