mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-24 15:28:28 +01:00
dvcignore: fix bug in subrepo detection (#3880)
This commit is contained in:
+1
-1
@@ -84,7 +84,7 @@ class DvcIgnoreRepo(DvcIgnore):
|
||||
def is_dvc_repo(directory):
|
||||
from dvc.repo import Repo
|
||||
|
||||
return os.path.isdir(os.path.join(directory, Repo.DVC_DIR))
|
||||
return os.path.isdir(os.path.join(root, directory, Repo.DVC_DIR))
|
||||
|
||||
dirs = [d for d in dirs if not is_dvc_repo(d)]
|
||||
|
||||
|
||||
@@ -182,18 +182,27 @@ def test_meta_is_preserved(tmp_dir, dvc):
|
||||
|
||||
def test_parent_repo_collect_stages(tmp_dir, scm, dvc):
|
||||
tmp_dir.gen({"subdir": {}})
|
||||
tmp_dir.gen({"deep": {"dir": {}}})
|
||||
subrepo_dir = tmp_dir / "subdir"
|
||||
deep_subrepo_dir = tmp_dir / "deep" / "dir"
|
||||
|
||||
with subrepo_dir.chdir():
|
||||
subrepo = Repo.init(subdir=True)
|
||||
subrepo_dir.gen("subrepo_file", "subrepo file content")
|
||||
subrepo.add("subrepo_file")
|
||||
|
||||
with deep_subrepo_dir.chdir():
|
||||
deep_subrepo = Repo.init(subdir=True)
|
||||
deep_subrepo_dir.gen("subrepo_file", "subrepo file content")
|
||||
deep_subrepo.add("subrepo_file")
|
||||
|
||||
stages = dvc.collect(None)
|
||||
subrepo_stages = subrepo.collect(None)
|
||||
deep_subrepo_stages = deep_subrepo.collect(None)
|
||||
|
||||
assert stages == []
|
||||
assert subrepo_stages != []
|
||||
assert deep_subrepo_stages != []
|
||||
|
||||
|
||||
def test_stage_strings_representation(tmp_dir, dvc, run_copy):
|
||||
|
||||
Reference in New Issue
Block a user