diff --git a/dvc/scm/git.py b/dvc/scm/git.py index 22318d781..5b3965f15 100644 --- a/dvc/scm/git.py +++ b/dvc/scm/git.py @@ -183,13 +183,12 @@ class Git(Base): return entry, gitignore def _ignored(self, path): - from git.exc import GitCommandError + from dulwich import ignore + from dulwich.repo import Repo - try: - self.repo.git.check_ignore(path) - return True - except GitCommandError: - return False + repo = Repo(self.root_dir) + manager = ignore.IgnoreFilterManager.from_repo(repo) + return manager.is_ignored(relpath(path, self.root_dir)) def ignore(self, path): entry, gitignore = self._get_gitignore(path) diff --git a/setup.py b/setup.py index 083b7c11e..7087a7e5f 100644 --- a/setup.py +++ b/setup.py @@ -50,6 +50,7 @@ install_requires = [ "colorama>=0.3.9", "configobj>=5.0.6", "gitpython>3", + "dulwich>=0.20.6", "setuptools>=34.0.0", "nanotime>=0.5.2", "pyasn1>=0.4.1",