check root .gitignore in '_ignored'#3284
Conversation
…t .gitignore. Added corresponding functional test
| # 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.
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.
|
@Aljo-Rovco Thank for the PR! 🙏 Looks great! Please see my comment above and also please install |
| # by the .gitignore file in the root dir. | ||
|
|
||
| entry = ( | ||
| entry[1:] if entry[0] == "/" else entry |
There was a problem hiding this comment.
| entry[1:] if entry[0] == "/" else entry | |
| entry = entry.lstrip("/") |
There was a problem hiding this comment.
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.
hmm don't know what happened there haha
| filter(lambda x: x.strip() == entry.strip(), ignore_list) | ||
| ) | ||
| return False | ||
| def _ignored(self, entry, gitignore_path): |
There was a problem hiding this comment.
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
.gitignoreWhen a file is already ignored through the root-dir
.gitignorefile, we don't want to add it to the "local".gitignorefile created by dvcFixes #1714