user772401
user772401

Reputation: 2904

How does this gitignore regex work "*,cover"

The python .gitinore provided by GitHub has the following regex,

*,cover

on line 49.

What exactly does this regex mean? Is it, "anything, then a comma, then the word cover"?

Upvotes: 1

Views: 585

Answers (3)

Cito
Cito

Reputation: 5613

I have also seen this as *.py,cover to ignore files created by the AnnotateReporter of Coverage.py that have the file extension .py,cover - the comma is not a typo here and also not part of the wildcard syntax, it's just a literal comma.

Upvotes: 2

Younggun Kim
Younggun Kim

Reputation: 986

It was a typo. Fixed now with following PR.

https://github.com/github/gitignore/pull/2379

Upvotes: 1

Matthieu Moy
Matthieu Moy

Reputation: 16547

It's not a regex, but a wildcard. In regex (regular expressions), * means "repeated as many times as you want", and comes as a postfix operator. In wildcards, * means, as you guessed, "anything".

Upvotes: 2

Related Questions