@@ -104,7 +104,7 @@ def is_out_or_ignored(root, directory):
104104 dirs [:] = [d for d in dirs if not is_out_or_ignored (root , d )]
105105
106106
107- def _load_data_from_tree (index , prefix , ws , key , tree ):
107+ def _load_data_from_tree (index , prefix , ws , key , tree , hash_name ):
108108 from dvc_data .index import DataIndexEntry , Meta
109109
110110 parents = set ()
@@ -117,7 +117,7 @@ def _load_data_from_tree(index, prefix, ws, key, tree):
117117 index [(* prefix , ws , * fkey )] = DataIndexEntry (
118118 key = fkey ,
119119 meta = ometa ,
120- hash_info = ohi ,
120+ hash_info = ohi if ( ohi and ohi . name == hash_name ) else None ,
121121 )
122122
123123 for parent in parents :
@@ -151,7 +151,7 @@ def _load_data_from_outs(index, prefix, outs):
151151 tree = out .get_obj ()
152152
153153 if tree is not None :
154- _load_data_from_tree (index , prefix , ws , key , tree )
154+ _load_data_from_tree (index , prefix , ws , key , tree , out . hash_name )
155155
156156 entry = DataIndexEntry (
157157 key = key ,
@@ -193,16 +193,22 @@ def _load_storage_from_import(storage_map, key, out):
193193 return
194194
195195 dep = out .stage .deps [0 ]
196- if not out .hash_info and (
197- not dep .hash_info or dep .hash_info .name != storage_map [key ].cache .odb .hash_name
198- ):
199- # partial import
196+ if not out .hash_info or dep .fs .version_aware :
197+ if dep .meta and dep .meta .isdir :
198+ meta_token = dep .hash_info .value
199+ else :
200+ meta_token = tokenize (dep .meta .to_dict ())
201+
200202 fs_cache = out .repo .cache .fs_cache
201203 storage_map .add_cache (
202204 FileStorage (
203205 key ,
204206 fs_cache .fs ,
205- fs_cache .fs .join (fs_cache .path , dep .fs .protocol , tokenize (dep .fs_path )),
207+ fs_cache .fs .join (
208+ fs_cache .path ,
209+ dep .fs .protocol ,
210+ tokenize (dep .fs_path , meta_token ),
211+ ),
206212 )
207213 )
208214
0 commit comments