gitignore_parser icon indicating copy to clipboard operation
gitignore_parser copied to clipboard

Pretty serious anchoring bug causes spurious matches

Open vlovich opened this issue 5 years ago • 4 comments

.gitignore contents: build

<path to project>/abcbuild matches even though such a pattern is supposed to only match if the file name is exactly that.

vlovich avatar Jul 08 '20 15:07 vlovich

I'll be happy to accept a PR that fixes this.

mherrmann avatar Jul 08 '20 16:07 mherrmann

Posted the PR although I don't know the spec well enough. https://github.com/snark/ignorance/issues/1 has a different proposal for anchoring. Can you let me know which solution is correct?

vlovich avatar Jul 08 '20 16:07 vlovich

I'm afraid I don't know which solution is correct. I also don't have time to look into it. You mention in your PR that you are not entirely sure it is the right behavior. I would love to have a more confident opinion, by either you or others, that your proposed change really conforms to the spec.

mherrmann avatar Jul 14 '20 08:07 mherrmann

I believe a ran into this same issue:

# .gitignore
build/

will match both build/ directory and sdist_build.py.

For reference, an alternative project that works for python <3.6 is https://pypi.org/project/pathspec/.

Azmisov avatar Nov 19 '20 22:11 Azmisov

Hello Is this issue fixed in release 0.1.2 ?

thebaptiste avatar Jan 04 '23 10:01 thebaptiste

I have a issue like this: A project managed by git. And the gitignore config like this: '*/build'. And the file abs path like: ./B/build/a.java is not ignored!

jacky1234 avatar Mar 17 '23 09:03 jacky1234

This was probably resolved by #58.

mherrmann avatar Oct 04 '23 14:10 mherrmann