Skip to content

Commit

Permalink
dvcignore: ignore file '.git' by default (#5745)
Browse files Browse the repository at this point in the history
* dvcignore: ignore file '.git' by default

* update tests
  • Loading branch information
pmrowla authored Mar 31, 2021
1 parent e911688 commit 4d4f942
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion dvc/ignore.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/func/test_ignore.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 4d4f942

Please sign in to comment.