mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-10 23:10:42 +01:00
get: fix override external repo cache type
This commit is contained in:
+1
-6
@@ -3,7 +3,6 @@ import os
|
||||
|
||||
import shortuuid
|
||||
|
||||
from dvc.config import Config
|
||||
from dvc.exceptions import GetDVCFileError
|
||||
from dvc.exceptions import NotDvcRepoError
|
||||
from dvc.exceptions import OutputNotFoundError
|
||||
@@ -48,11 +47,7 @@ def get(url, path, out=None, rev=None):
|
||||
#
|
||||
# Also, we can't use theoretical "move" link type here, because
|
||||
# the same cache file might be used a few times in a directory.
|
||||
repo.config.set(
|
||||
Config.SECTION_CACHE,
|
||||
Config.SECTION_CACHE_TYPE,
|
||||
"reflink,hardlink,copy",
|
||||
)
|
||||
repo.cache.local.cache_types = ["reflink", "hardlink", "copy"]
|
||||
|
||||
o = repo.find_out_by_relpath(path)
|
||||
with repo.state:
|
||||
|
||||
@@ -5,9 +5,11 @@ import os
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.config import Config
|
||||
from dvc.exceptions import GetDVCFileError
|
||||
from dvc.exceptions import UrlNotDvcRepoError
|
||||
from dvc.repo import Repo
|
||||
from dvc.system import System
|
||||
from dvc.utils import makedirs
|
||||
from tests.utils import trees_equal
|
||||
|
||||
@@ -34,6 +36,23 @@ def test_get_repo_dir(repo_dir, erepo):
|
||||
trees_equal(src, dst)
|
||||
|
||||
|
||||
def test_cache_type_is_properly_overridden(repo_dir, erepo):
|
||||
erepo.dvc.config.set(
|
||||
Config.SECTION_CACHE, Config.SECTION_CACHE_TYPE, "symlink"
|
||||
)
|
||||
erepo.dvc.scm.add([erepo.dvc.config.config_file])
|
||||
erepo.dvc.scm.commit("set cache type to symlinks")
|
||||
|
||||
src = erepo.FOO
|
||||
dst = erepo.FOO + "_imported"
|
||||
|
||||
Repo.get(erepo.root_dir, src, dst)
|
||||
|
||||
assert not System.is_symlink(dst)
|
||||
assert os.path.exists(dst)
|
||||
assert os.path.isfile(dst)
|
||||
|
||||
|
||||
def test_get_repo_rev(repo_dir, erepo):
|
||||
src = "version"
|
||||
dst = src
|
||||
|
||||
Reference in New Issue
Block a user