Skip to content
This repository has been archived by the owner on Jan 24, 2025. It is now read-only.

Correct VisualStudio coverage pattern. #378

Merged
merged 1 commit into from
May 4, 2021
Merged

Conversation

wpafbo79
Copy link
Contributor

Fix incorrect usage of the "[]" pattern format.

From Git documentation:
"[]" matches one character in a selected range.

Pull Request

Thank you for contributing to @dvcs/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

  • Template - Update existing .gitignore template

Details

The previous usage of the range pattern ("[]") did not work as likely intended. From the Git documentation

The range notation, e.g. [a-zA-Z], can be used to match one of the characters in a range.

Assumption was that the following rules were being condensed:

coverage*.json
coverage*.xml
coverage*.info

So:

coverage*[.json, .xml, .info]

acts as:

coverage*[.json, xmlif]

with duplicates removed, where only one character of the range pattern ([]) characters will be matched. The rest of the characters will be matched by the *.

This results in unintended matches (e.g. coveragetype.sql). The characters type.sq would be matched with * and the l would be matched by either form, [.json, .xml, .info] or [.json, xmlif].

Fix incorrect usage of the "[]" pattern format.

From Git documentation:
  "[]" matches one character in a selected range.
@pedrosanta
Copy link
Contributor

Just my 2 cents: wasn't it better and more readable etc to have the rules not condensed at all? I see that your proposal effectively solves the issue, but wouldn't it be better and more readable to just have all the three extensions stated?

@pedrosanta
Copy link
Contributor

Actually FYI @wpafbo79 the VisualStudio.gitignore over at github/gitignore already had this fixed on github/gitignore#3454 as I proposed above, so if you run moban as per Readme you should be able to have this file synced and this fixed. Or just update (copy paste) to match the github/gitignore VisualStudio.gitignore, that works too—and is simpler.

@gobr gobr merged commit d271647 into toptal:master May 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants