Skip to content

Commit

Permalink
index: make build_entry raise on FileNotFound
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop committed Jun 12, 2023
1 parent 96c789c commit abf729e
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/dvc_data/index/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ def build_entry(
hash_name: str = DEFAULT_ALGORITHM,
):
if info is None:
try:
info = fs.info(path)
except FileNotFoundError:
return DataIndexEntry()
info = fs.info(path)

if compute_hash and info["type"] != "directory":
meta, hash_info = hash_file(
Expand Down Expand Up @@ -62,13 +59,16 @@ def build_entries(
root_key = fs.path.relparts(root, path)

for name in chain(dirs, files):
entry = build_entry(
fs.path.join(root, name),
fs,
compute_hash=compute_hash,
state=state,
hash_name=hash_name,
)
try:
entry = build_entry(
fs.path.join(root, name),
fs,
compute_hash=compute_hash,
state=state,
hash_name=hash_name,
)
except FileNotFoundError:
entry = DataIndexEntry()
entry.key = (*root_key, name)
yield entry

Expand Down

0 comments on commit abf729e

Please sign in to comment.