@@ -51,6 +51,8 @@ def get(url, path, out=None, rev=None):
5151 try :
5252 cached_clone (url , rev = rev , clone_path = tmp_dir )
5353 try :
54+ repo = Repo (tmp_dir )
55+
5456 # Try any links possible to avoid data duplication.
5557 #
5658 # Not using symlink, because we need to remove cache after we are
@@ -60,21 +62,23 @@ def get(url, path, out=None, rev=None):
6062 #
6163 # Also, we can't use theoretical "move" link type here, because
6264 # the same cache file might be used a few times in a directory.
63- repo = Repo (tmp_dir )
6465 repo .cache .local .cache_types = ["reflink" , "hardlink" , "copy" ]
66+
6567 output = repo .find_out_by_relpath (path )
66- if not output .use_cache :
68+ if output .use_cache :
6769 # Catch this below and go for a plain old fs_copy
68- raise _DoPlainCopy
69- _get_cached (repo , output , out )
70+ _get_cached (repo , output , out )
71+ return
72+
73+ except (NotDvcRepoError , OutputNotFoundError ):
74+ pass
7075
71- except (NotDvcRepoError , OutputNotFoundError , _DoPlainCopy ):
72- # It's an uncached out with absolute path, a non-DVC repo, or a
73- # user error
74- if os .path .isabs (path ):
75- raise FileNotFoundError
76+ # It's an uncached out with absolute path, a non-DVC repo, or a
77+ # user error
78+ if os .path .isabs (path ):
79+ raise FileNotFoundError
7680
77- fs_copy (os .path .join (tmp_dir , path ), out )
81+ fs_copy (os .path .join (tmp_dir , path ), out )
7882
7983 except (OutputNotFoundError , FileNotFoundError ):
8084 raise PathMissingError (path , url )
0 commit comments