-
Notifications
You must be signed in to change notification settings - Fork 43
Add a parse_gitignore_string so you don't need a real .gitignore file. #74
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
Conversation
|
Thank you for the PR. Why is it necessary? Can you add a test? |
|
Thank you, I added a test. I'm using this in https://github.com/tewalds/replace , which is a simple find/replace tool, ie a worse ripgrep but that actually replaces as well. It's useful to ignore everything that isn't tracked as they're almost certainly generated files or otherwise not interesting, but it kept returning matches/failures from the |
|
I see, thank you for explaining. I understand the need and appreciate the PR, but I feel that a "gitignore parser" should parse .gitignore files, and nothing else. I believe you have a point from a practical perspective, but I'm a purist at heart and can't bring myself to violate that. |
|
Well, then it'd be nice to have a way of parsing a string instead of a file without mocking |
|
I guess another option would be to make it optional, eg a |
|
Yes, I'm open to a PR that adds a function |
|
Ok, this is a much bigger change, both to the library and the tests, but hopefully you agree this is an improvement. This also fixes #6 along the way. |
|
Done. |
|
The CI seems to be failing due to python versions, so fixed in: #75 |
This is useful if you want to list only the files that git would track. It clearly doesn't track its own files.
…he need for a lot of mocks.
…_parse_gitignore_lines, simplify the interface of parse_gitignore_str.
mherrmann
left a comment
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.
If you wanted to add a few lines to the README that explain the new function, that would be great; if not, I can do it as well.
|
I added an example to the README as well. |
No description provided.