Why does TortoiseHg not add packages.config - nuget

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$)

Related

Unity Gitignore not ignoring binary files

I have a problem with the .gitignore file in my Multiplayer Unity game project (consists of a game server and a client project in a single repository). The .gitignore file ignores most of the files, but not the binary files from the library artifacts.
Image of binary files showing in Github Desktop.
I know the .gitignore file works because if I remove it there is 30000 changed files and 8000 without removing it.
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
[Ll]ogs/
[Uu]ser[Ss]ettings/
# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/
# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta
# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*
# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*
# Visual Studio cache directory
.vs/
# Gradle cache directory
.gradle/
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db
# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta
# Unity3D generated file on crash reports
sysinfo.txt
# Builds
*.apk
*.aab
*.unitypackage
# Crashlytics generated file
crashlytics-build.properties
# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*
Image of the repository folder with the 2 projects
hehe i think your answer is on the first line of the .gitignore
This .gitignore file should be placed at the root of your Unity project directory
All of those ignore paths without a preceeding / are only relative to the location of the .gitignore. It works like so:
Will ignore:
./Build/myBinary
Will not ignore:
./project1/Build/myBinary
./project2/Build/myBinary
Simplest solution is to duplicate your .gitignore and place one of each at the root of each project directory, not the repo directory.
Your directory should look like this:
myRepo
project1
.gitignore
Assets
...
project2
.gitignore
Assets
...
As mentioned, if files in these directories have already been committed they will need to be removed manually.
To be sure, assuming there are only binaries in this folders, try and delete them (from the Git index only, not from your disk), and check immediately (no commit needed) if your .gitignore applies.
cd /path/to/repo
git rm -r --cached path/to/folder/with/binaries/ # note the trailing slash
git check-ignore -v path/to/folder/with/binaries/aBinary # must be a file
If the last command does not return anything, then no .gitignore rule applies.

How do you re-ignore files using .artifactignore with PublishPipelineArtifacts#2

I have a .artifactignore at the root of my repository that looks like:
**/*
!**/bin/**/*
!**/obj/**/*
I can observe the .artifactignore being evaluated in the logs such as this:
Uploading pipeline artifact from d:\a\1\s for build #10471
Information, ApplicationInsightsTelemetrySender will correlate events with X-TFS-Session GUID
Information, DedupManifestArtifactClient will correlate http requests with X-TFS-Session GUID
Information, Using .artifactignore file located at: d:\a\1\s\.artifactignore for globbing
Information, Processing .artifactignore file surfaced 20721 files. Total files under source directory: 21471
This correctly excludes everything but bin and obj directories. I would like to extend this .artifactignore such that it has the additional behavior:
Ignores all pdb files regardless of their location
I have tried several variations:
**/*
!**/bin/**/*
!**/obj/**/*
*.pdb
**/*
!**/bin/**/*
!**/obj/**/*
.pdb
**/*
!**/bin/**/*
!**/obj/**/*
**/*.pdb
**/*
!**/bin/**/*
!**/obj/**/*
!!*.pdb
**/*
!**/bin/**/*
!**/obj/**/*
!!**/*.pdb
**/*
!**/bin/
!**/obj/
!!**/*.pdb
With several other variations I'm sure. All of these contain all of the .pdb files that are present in the bin folders.
How do I publish all the bin and obj folders without bringing along the .pdb files?
How do I publish all the bin and obj folders without bringing along the .pdb files?
I am afraid there is no such out of box syntax you could re-include a file if a parent directory of that file is excluded.
That means, you use the syntax !**/bin/**/* to exclude the parent folder bin from the .artifactignore file, you could not re-use the syntax *.pdb or any other to re-include the file .pdb.
As the document state:
Refer to the Git guidance on the .gitignore syntax, the syntax for
.artifactignore is the same.
To check the details info, you could refer this thread about .gitignore syntax.
As workaround for this issue, we could use following syntax to including all the file types except the .pdb file:
**/*
!**/bin/**/*.dll
!**/bin/**/*.xml
!**/bin/**/*.config
!**/obj/**/*.dll
!**/obj/**/*.xml
!**/obj/**/*.config
Hope this helps.

How to fix .gitignore such that it can allow *.meta files to be uploaded

I'm using gitignore.io to generate a .gitignore file, using unity and visual studio as search terms. However, after uploading it to my repo, i realized that the *.meta files are not uploaded. It seems to be ignored, which shouldn't be the case as ![Aa]ssets/**/*.meta should never ignore any .meta files in any folder under the Assets folder.
Edit: this .gitignore is placed in the root of my repo.
Below is the generated file.
# Created by https://www.gitignore.io/api/unity,visualstudio
# Edit at https://www.gitignore.io/?templates=unity,visualstudio
### Unity ###
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
[Ll]ogs/
# Never ignore Asset meta data
![Aa]ssets/**/*.meta
# Uncomment this line if you wish to ignore the asset store tools plugin
# [Aa]ssets/AssetStoreTools*
# TextMesh Pro files
[Aa]ssets/TextMesh*Pro/
# Visual Studio cache directory
.vs/
# Gradle cache directory
.gradle/
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db
# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta
# Unity3D generated file on crash reports
sysinfo.txt
# Builds
*.apk
*.unitypackage
# Crashlytics generated file
crashlytics-build.properties
### VisualStudio ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Ll]og/
# Visual Studio 2015/2017 cache/options directory
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- Backup*.rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# End of https://www.gitignore.io/api/unity,visualstudio
The problem is .gitignore is processed sequentially. Somewhere below your Never ignore Asset metadata line, you have
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
...
Placing your Never ignore rule at the bottom of the .gitignore will let it activate.
Source: Gitignore documentation (emphasis mine)
Each line in a gitignore file specifies a pattern. When deciding whether to ignore a path, Git normally checks gitignore patterns from multiple sources, with the following order of precedence, from highest to lowest (within one level of precedence, the last matching pattern decides the outcome):

What does your .gitignore file look like for a Unity project?

I'm starting out with Unity and I've noticed that even with small code changes result in a large git diff.
Originally, my .gitignore just had this:
Temp/
but it's not doing much heavy lifting.
I found this .gitignore template on Github, but I'm curious if anyone else uses this--either as a starting point or as-is.
I use to use that same .gitignore with no issues at all, as-is. Works on both macOS and Windows.
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/Assets/AssetStoreTools*
# Visual Studio 2015 cache directory
/.vs/
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
# Unity3D generated meta files
*.pidb.meta
# Unity3D Generated File On Crash Reports
sysinfo.txt
# Builds
*.apk

Gitignore for Eclipse

In our semester group we are using eclipse as an IDE for developing a Compiler. The issue is when it comes to git. Which files are okay to be ignored and which are crucial. It works fine on my computer, but when it is synced with git and another member from the group is trying to use the workspace, there always seem to be some errors about main not showing or a package is wrong.
Bottom line: What is okay, and what is not okay to include in .gitignore file, so that every group member is able to compile the project?
I think the best solution is to generate .gitignore for yourself by gitignore.io.
Just choose tools that you used.
It depends on your requirement.
Usually Compiled source,Packages, Logs and databases, Eclipse specific files/directories are removed from git push. Also can keep configuration in separate(property) file.It is easy to place project in a different environment.
This is a sample gitignore file
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# Logs and databases #
######################
*.log
# OS generated files #
######################
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db
# Editor Files #
################
*~
*.swp
# Gradle Files #
################
.gradle
.m2
# Build output directies #
##########################
/target
*/target
/build
*/build
# IntelliJ specific files/directories #
#######################################
out
.idea
*.ipr
*.iws
*.iml
atlassian-ide-plugin.xml
# Eclipse specific files/directories #
######################################
.classpath
.project
.settings
.metadata
# NetBeans specific files/directories #
#######################################
.nbattrs