Reputation: 10871
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
Upvotes: 3
Views: 1747
Reputation: 4208
You may need to tell mercurial where the global ignore file is located. I had to add this line under the [ui]
section of my .hgrc
for it to work.
ignore = ~/.hgignore
Upvotes: 0
Reputation: 10871
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.
Upvotes: 5
Reputation: 66059
The glob
match syntax takes the path into account. You can switch to syntax: relglob
for relative pathnames or prefix your patterns with **/
.
Upvotes: 1