dvcignore: ignore file '.git' by default (#5745)

* dvcignore: ignore file '.git' by default

* update tests
This commit is contained in:
Peter Rowlands (변기호)
2021-03-31 13:47:34 +03:00
committed by GitHub
parent e91168812a
commit 4d4f9427d1
2 changed files with 8 additions and 3 deletions
+6 -1
View File
@@ -183,7 +183,12 @@ class DvcIgnoreFilter:
def __init__(self, fs, root_dir):
from dvc.repo import Repo
default_ignore_patterns = [".hg/", ".git/", "{}/".format(Repo.DVC_DIR)]
default_ignore_patterns = [
".hg/",
".git/",
".git",
"{}/".format(Repo.DVC_DIR),
]
self.fs = fs
self.root_dir = root_dir
+2 -2
View File
@@ -112,7 +112,7 @@ def test_ignore_collecting_dvcignores(tmp_dir, dvc, dname):
assert (
DvcIgnorePatterns(
*merge_patterns(
_to_pattern_info_list([".hg/", ".git/", ".dvc/"]),
_to_pattern_info_list([".hg/", ".git/", ".git", ".dvc/"]),
os.fspath(tmp_dir),
_to_pattern_info_list([os.path.basename(dname)]),
top_ignore_path,
@@ -344,7 +344,7 @@ def test_pattern_trie_fs(tmp_dir, dvc):
)
base_pattern = (
_to_pattern_info_list([".hg/", ".git/", ".dvc/"]),
_to_pattern_info_list([".hg/", ".git/", ".git", ".dvc/"]),
os.fspath(tmp_dir),
)
first_pattern = merge_patterns(