I have the following in my .hgignore
file:
syntax: glob
obj/*
bin/*
*.suo
*.user
*.ncb
If I comment out the *.
filters, the filtering works fine filtering out the files in the bin
and obj
folder, however, if I keep those filters in I receive the following error:
abort: c:\temp\.hgignore: invalid pattern (relre): *.suo
Note: The file is encoded in UTF-8
The error message from Mercurial tells us that your
syntax: glob
line is not read by Mercurial. Patterns in ignore files default to regular expressions, and*.suo
is indeed an invalid regular expression (a regex cannot start with*
).Since this is on Windows, and since the file is UTF-8 encoded, then the only reasonable explanation is that there is somehthing that makes Mercurial ignore the
syntax: glob
line. An UTF-8 BOM is such a "something"! A byte order mark is a small signature inserted into UTF-16 encoded files to signal the byte order of the file. This is not needed or recommended for UTF-8 encoded files, but Windows editors have a tendency to insert them anyway.To fix this, please open the file in Notepad and choose "Save As". Then pick ANSI as the encoding. Your
.hgignore
file is pure ASCII, so this will effective be the same as UTF-8 without a BOM.