From b2a95c3ed7e087be3281e8981ddf011006f717f2 Mon Sep 17 00:00:00 2001 From: karajan1001 Date: Mon, 10 Aug 2020 22:18:23 +0800 Subject: [PATCH 1/2] Remove dvcignore reset in `repo._reset` Repo `add`,`checkout`,etc will not change `.dvcignore`, and can remove dvcignore reset after these operations. --- dvc/repo/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/dvc/repo/__init__.py b/dvc/repo/__init__.py index 6d98682727..329dafa034 100644 --- a/dvc/repo/__init__.py +++ b/dvc/repo/__init__.py @@ -615,4 +615,3 @@ def _reset(self): self.__dict__.pop("graph", None) self.__dict__.pop("stages", None) self.__dict__.pop("pipelines", None) - self.tree.__dict__.pop("dvcignore", None) From 6cf5b934d3e2f42169be6981235c95f4a3e31619 Mon Sep 17 00:00:00 2001 From: karajan1001 Date: Tue, 11 Aug 2020 11:48:51 +0800 Subject: [PATCH 2/2] Reset dvcignore manually after a subrepo created. 1. subrepo created during session open time. --- tests/func/test_tree.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/func/test_tree.py b/tests/func/test_tree.py index ad09e5312f..a53a515a2e 100644 --- a/tests/func/test_tree.py +++ b/tests/func/test_tree.py @@ -258,6 +258,7 @@ def test_walk_dont_ignore_subrepos(tmp_dir, scm, dvc): scm.commit("Add subrepo") dvc_tree = dvc.tree + dvc_tree.__dict__.pop("dvcignore") scm_tree = scm.get_tree("HEAD", use_dvcignore=True) path = os.fspath(tmp_dir) get_dirs = itemgetter(1)