Fix vim swap file rule
Pull Request
Thank you for contributing to @toptal/gitignore and https://www.gitignore.io.
New or update
Select the appropriate check box for this pull request. This helps when merging to ensure there are no conflicts with other templates or misunderstandings of how thee template list works.
New
- [ ] Template - New
.gitignoretemplate - [ ] Composition - Template made from smaller templates
- [ ] Inheritance - Template similar to an existing template
- [ ] Patch - Template extending functionality of existing template
Update
- [x] Template - Update existing
.gitignoretemplate
Details
Trailing comments are not legal comments, despite GitHub rendering it as a comment. Only lines starting with # are ignored. See https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#Ignoring-Files.
This also makes the negation more specific to only files that could have been ignored by the preceding rule.
hi @steinybot, thank you so much for taking the time to work on it. I saw that you have fixed the comment but i couldn't see any explanation why you have changed from !*.svg to ![._]*.svg. Could you tell me the reason please ?
This PR is stale because it has been open for 30 days with no activity.
That relates to this comment:
This also makes the negation more specific to only files that could have been ignored by the preceding rule.
The issue is the preceding rule specifically matches something that begins with either a . or _:
# Swap
[._]*.s[a-v][a-z]
This would ignore .cat.svg.
The negative match must require the same prefix as the rule it is negating otherwise it could be negating something else.
# Comment out if you don't need vector files
![._]*.svg
Hypothetically, if we had:
junk.svg
[._]*.s[a-v][a-z]
!*.svg
junk.svg would be incorrectly un-ignored.
This PR is stale because it has been open for 30 days with no activity.
Hey @steinybot
Thank you for the contribution and explanations. I just noticed, though, that this file is mirrored from the upstream. Any changes we apply here will be overwritten by the CI. You may want to contribute to the upstream repository and our CI will automatically pick them up as soon as they're merged into the master branch.