From 9930e96390748e44b4c5d8de4a38e84ae66d5d48 Mon Sep 17 00:00:00 2001 From: Dani Hodovic Date: Tue, 3 Dec 2019 14:50:11 +0100 Subject: [PATCH] fixup! ensure absolute paths for dvc files work but not for git --- dvc/repo/get.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/dvc/repo/get.py b/dvc/repo/get.py index 69ab2d538..7ea599844 100644 --- a/dvc/repo/get.py +++ b/dvc/repo/get.py @@ -21,13 +21,12 @@ logger = logging.getLogger(__name__) def _copy_git_file(repo, src, dst): - # Assert that the file does indeed exist in git before attempting to - # copy it. - if src not in repo.scm.repo.head.commit.tree: - raise FileOutsideRepoError(src) - src_full_path = os.path.join(repo.root_dir, src) dst_full_path = os.path.abspath(dst) + + if repo.root_dir not in src_full_path: + raise FileOutsideRepoError(src) + if os.path.isdir(src_full_path): shutil.copytree(src_full_path, dst_full_path) else: