-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
check root .gitignore in '_ignored' #3284
Changes from 1 commit
8a76742
4d772fe
fd75bbd
72919ee
ea61fa6
468daec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,8 +133,18 @@ def _get_gitignore(self, path): | |
|
||
return entry, gitignore | ||
|
||
@staticmethod | ||
def _ignored(entry, gitignore_path): | ||
def _ignored(self, entry, gitignore_path): | ||
|
||
# We want to check first if `entry` is already being ignored by the .gitignore file in the root dir. | ||
entry_path = os.path.join(os.path.dirname(gitignore_path), entry) | ||
from git.exc import GitCommandError | ||
try: | ||
self.repo.git.check_ignore(entry_path) | ||
return True | ||
except GitCommandError: | ||
# If none of the paths passed to `check_ignore` are ignored, GitPython annoyingly raises an Exception | ||
pass | ||
|
||
if os.path.exists(gitignore_path): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Btw, we no longer need to manually read gitignore as if the entry is present there, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah interesting. Will change that |
||
with open(gitignore_path, "r") as fobj: | ||
ignore_list = fobj.readlines() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can simply pass
path
to it now, since we no longer work with entries. π Your PR is helping tidy this a lot π