index: build_data_index: use dvcignore

Fixes #9008
This commit is contained in:
Ruslan Kuprieiev
2023-02-14 21:33:43 +02:00
parent 99bbe15980
commit 446871d84f
+9 -1
View File
@@ -589,6 +589,10 @@ def build_data_index(
from dvc_data.index.build import build_entries, build_entry
from dvc_data.index.save import build_tree
ignore = None
if workspace == "repo" and isinstance(fs, LocalFileSystem):
ignore = index.repo.dvcignore
data = DataIndex()
for key in index.data_keys.get(workspace, set()):
out_path = fs.path.join(path, *key)
@@ -610,7 +614,11 @@ def build_data_index(
continue
for entry in build_entries(
out_path, fs, compute_hash=compute_hash, state=index.repo.state
out_path,
fs,
compute_hash=compute_hash,
state=index.repo.state,
ignore=ignore,
):
if not entry.key or entry.key == ("",):
# NOTE: whether the root will be returned by build_entries