gitignore.io icon indicating copy to clipboard operation
gitignore.io copied to clipboard

Proposal: Sort '!' to the bottom of the gitignore file, so inclusions are more important than exclusions

Open constant-flow opened this issue 1 year ago • 0 comments

Issue

The unity and visual studio templates conflict with each other in the sense that unity relies heavily on *.meta files when versioned and VS is excluding these files. Both solutions are used alongside very often, so they should be matched to work together.

You say now: This sounds like a template issue, you are right, but I'd propose an improvement to this tool.

For example: This tool could check if the one is having a !*.meta where the other is having a *.meta (unfortunately unity's template doesn't use this notation yet)

Expected Behavior:

Either

  • Give info where the templates conflict, give users a chance to select which rule is active or inactive. e.g. track *.meta or ignore *.meta
  • OR (even better solution) automatically see the ! listed items as more important as the exclusion, so basically sorting all the sections (all items listed under a # section) containing ! items to the bottom of the generated file (order in .gitignore matters)

so for example, this whole section should go to the end of the generated gitignore file

# Unity3D generated meta files (include & exclude)
!*.meta
*.pidb.meta
*.pdb.meta
*.mdb.meta

Actual Behavior:

  • stapling files together, order in list will define who wins the fight over inclusion or exclusion

Reproduction Steps:

  • generate a file with unity and visualstudio together --> will exclude *.meta files
  • even if unity would include a !*.meta file, the order would decide which on wins (inc/exc)

constant-flow avatar Sep 21 '23 07:09 constant-flow