Skip to content
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

gitignore /a should differ from 'a' #16

Open
GerHobbelt opened this issue Jul 5, 2020 · 0 comments
Open

gitignore /a should differ from 'a' #16

GerHobbelt opened this issue Jul 5, 2020 · 0 comments

Comments

@GerHobbelt
Copy link

https://git-scm.com/docs/gitignore#_pattern_format

If there is a separator at the beginning or middle (or both) of the pattern, then the pattern is relative to the directory level of the particular .gitignore file itself. Otherwise the pattern may also match at any level below the .gitignore level.

[...]

For example, a pattern doc/frotz/ matches doc/frotz directory, but not a/doc/frotz directory; however frotz/ matches frotz and a/frotz that is a directory (all paths are relative from the .gitignore file).


Now gitignore-parser creates regexes for both which are wrong: only the /a should become /^a/ while a should be turned into a regex like /a/ (or possibly /(^|[\/])a/ ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant