gitignore icon indicating copy to clipboard operation
gitignore copied to clipboard

Fix vim swap file rule

Open steinybot opened this issue 3 years ago • 1 comments

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 .gitignore template
  • [ ] 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 .gitignore template

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.

steinybot avatar Sep 21 '22 23:09 steinybot

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 ?

yusufzmly avatar Sep 22 '22 08:09 yusufzmly

This PR is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Oct 23 '22 02:10 github-actions[bot]

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.

steinybot avatar Oct 23 '22 19:10 steinybot

This PR is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Nov 24 '22 02:11 github-actions[bot]

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.

filipechagas avatar Nov 24 '22 11:11 filipechagas