-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
feat: add ignore option #131
Conversation
src/sync_drive.py
Outdated
"""Check if folder is wanted.""" | ||
if ignore: | ||
if PathSpec.from_lines("gitwildmatch", ignore).match_file(f"{folder_path}/foo.bar"): |
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.
f"{folder_path}/foo.bar"
shouldn't this be folder_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.
This is necessary 😕. If you remove /foo.bar
the tests will not pass
If you have another suggestion, I can try it.
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 cpburnz/python-pathspec#65 is causing the tests to fail. Seems like pathspec
isn't the right fit for our needs. 😕
It might be easier to use something like https://pymotw.com/3/glob/ or our own implementation to check if entries in ignore
list matches the path and then return False
to ignore it.
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.
Glob is useful to find filenames, but do not seems helpful for testing 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.
Looks like glob
internally uses fnmatch
. fnmatch
seems to be a good fit for this feature.
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.
I've just tried fnmatch
it's the same problem
Allow to ignore folders and files
This required the installation of pathspec, to have the format like the
.gitignore
Closes #48 and #80