I use NuGet for package management on my .NET projects and one thing that happens consistently is that the package.config files get ignored for commit unless I explicitly add them. With any other file that is not specifically filtered by my .hgignore TortoiseHg suggests it be included in the commit dialog.

The contents of my .hgignore is this:

# Ignore file for Visual Studio 2008

# use glob syntax
syntax: glob

# Ignore Visual Studio 2008 files
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
*.lib
*.sbr
*.scc
*.orig
[Bb]in
[Dd]ebug*/
obj/
[Rr]elease*/
build*/
_ReSharper*/
[Pp]ackages*/
[Tt]est[Rr]esult*
[Bb]uild[Ll]og.*
*.[Pp]ublish.xml
Thumbs.db
desktop.ini

I see the None of this is tragic, just a bit of friction. Any thoughts as to why the package.config is being ignored?

Edit: OK I see the line that is likely responsible: [Pp]ackages*/ I think then the question is what pattern do I need that will filter out my packages directories, but let packages.config through? My regex is not so good so any help is appreciated.

有帮助吗?

解决方案

Delete [Pp]ackages*/ from glob section and add regexp-section with negative lookahead for package.config (TBT!):

syntax: regex
^packages.*/(?!package\.config$)
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top