Search code examples
command-linemercurialtortoisehghgignore

.hgignore doesn't seem to be working


I have a .hgignore file in my project's root directory and it's not doing squat. When I do an hg add, every single file in my project directory is being added and tracked. I get the same result whether I use tortoisehg or the command-line. Command-line is my preference. What's going on here?

My .hgignore (taken from another question on SO):

# use glob syntax
syntax: glob

*.obj
*.pdb
*.user
*.aps
*.pch
*.vspscc
*.vssscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
*.lib
*.sbr
*.scc
[Bb]in
[Dd]ebug*/
obj/
[Rr]elease*/
_ReSharper*/
[Tt]humbs.db
[Tt]est[Rr]esult*
[Bb]uild[Ll]og.*
*.[Pp]ublish.xml
*.resharper

Solution

  • Apparently it was some issue with the encoding of the file. I was editing the file in Notepad++ (tried ANSI and UTF-8 encodings) and the file looked fine when editing. I had given up and decided to start over by using the command notepad .hgignore. Then I pasted the contents from the file that was giving me trouble and everything was on a single line with no breaks. I fixed the breaks, saved the file and it immediately worked.

    I'm still not sure why the file looked fine in Notepad++ but was actually putting out garbage.