Skip to content

Commit

Permalink
index: check parents when trying to detect hash_name
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop committed Sep 28, 2023
1 parent f981500 commit 0053b1c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions dvc/repo/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,10 +801,14 @@ def _get_entry_hash_name(
) -> str:
from dvc_data.hashfile.hash import DEFAULT_ALGORITHM

try:
src_entry = index.data[workspace][key]
for idx in reversed(range(len(key) + 1)):
prefix = key[:idx]
try:
src_entry = index.data[workspace][prefix]
except KeyError:
continue

if src_entry.hash_info and src_entry.hash_info.name:
return src_entry.hash_info.name
except KeyError:
pass

return DEFAULT_ALGORITHM

0 comments on commit 0053b1c

Please sign in to comment.