Ignore files from .gitignore in Git loader (#2909)

fixes #2905 

extends #2851
This commit is contained in:
Kwuang Tang 2023-04-14 18:02:21 -04:00 committed by GitHub
parent 7ee87eb0c8
commit 66bef1d7ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,6 +54,10 @@ class GitLoader(BaseLoader):
file_path = os.path.join(self.repo_path, item.path) file_path = os.path.join(self.repo_path, item.path)
ignored_files = repo.ignored([file_path])
if len(ignored_files):
continue
# uses filter to skip files # uses filter to skip files
if self.file_filter and not self.file_filter(file_path): if self.file_filter and not self.file_filter(file_path):
continue continue