-
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
Conversation
β¦t .gitignore. Added corresponding functional test
dvc/scm/git/__init__.py
Outdated
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 comment
The 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, check_ignore
will tell us that. So we can safely remove the lines below.
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.
ah interesting. Will change that
@Aljo-Rovco Thank for the PR! π Looks great! Please see my comment above and also please install |
dvc/scm/git/__init__.py
Outdated
# by the .gitignore file in the root dir. | ||
|
||
entry = ( | ||
entry[1:] if entry[0] == "/" else entry |
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.
entry[1:] if entry[0] == "/" else entry | |
entry = entry.lstrip("/") |
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.
Looks like it won't be needed if we just pass path
to _ignored()
instead of putting the pieces back together.
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.
hmm don't know what happened there haha
dvc/scm/git/__init__.py
Outdated
filter(lambda x: x.strip() == entry.strip(), ignore_list) | ||
) | ||
return False | ||
def _ignored(self, entry, gitignore_path): |
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 π
@Aljo-Rovco Looks like formatting is still broken π Please try running
manually, it should fix it. |
Thanks @Aljo-Rovco ! Looks great! There is one unrelated test failing due to some logging nuances, but I'll take it from here and will adjust it myself. Thank you so much! |
β Have you followed the guidelines in the Contributing to DVC list?
π Check this box if this PR does not require documentation updates, or if it does and you have created a separate PR in dvc.org with such updates (or at least opened an issue about it in that repo). Please link below to your PR (or issue) in the dvc.org repo.
β Have you checked DeepSource, CodeClimate, and other sanity checks below? We consider their findings recommendatory and don't expect everything to be addressed. Please review them carefully and fix those that actually improve code or fix bugs.
git: check if files are handled by root-dir
.gitignore
When a file is already ignored through the root-dir
.gitignore
file, we don't want to add it to the "local".gitignore
file created by dvcFixes #1714