Documentation

Support

Unity Version Control

Use value matching pattern files

Find how to use value matching filter pattern rules in configuration files.
Read time 2 minutesLast updated 21 days ago

Use value matching filter pattern rules to set up specific client configuration files. A value matching pattern file assigns a value to items that match specified patterns. These files contain one pattern per line. Unity Version Control (UVCS) uses the path of each item to check whether it matches any of the rules and then returns the assigned value.

Value filter pattern files in UVCS

UVCS has the following value matching pattern files:
  • Compression type (
    compression.conf
    )
  • EOL sequence conversion (
    eolconversion.conf
    )
  • File type (
    filetypes.conf
    )
Each line in these files contains rule/value pairs. The
filetypes.conf
file uses the
:
character as a separator, but the files
compression.conf
and
eolconversion.conf
use whitespaces as the rule/value separator.
To comment a line, start the line with a
#
character.

Rule types

There are four types of patterns you can use with value matching pattern files. For more information on which rule types take precedence when you use multiple, refer to pattern hierarchy.

Extension rules

Extension rules define the exact extension of the files to match. These apply to the characters after the last
.
character in the file name. This means that values such as
.in.html
or
.en.rex
don’t match any files.

compression.conf example

In the following example, a file such as
/theme/images/background.png
doesn’t use compression, but a file such as
/src/client/main.cpp
uses gzip compression.
.png none.c zip.cpp zip

Path rules

Path rules compare the full path of an item and if they match, apply the rule value to that item.

eolconversion.conf example

In the following example, you use automatic EOL conversion for
/src/main.c
uses, and for
/lib/core/Calculator.cs
, you convert all of its EOL sequences to
CR
+
LF
:
/src/main.c auto/lib/core/Calculator.cs CRLF

Name rules

Name rules exactly match the item name.

filetypes.conf example

In the following example, you set a file such as
/my-app/wwwroot/img/header.png
as binary, but set files such as
/README.md or /src/doc/README.md
as text:
header.png:binREADME.md:txt

Wildcard rules

You can enhance path rules with wildcard sequences:
  • *
    matches any number of consecutive characters except the directory separator
    /
    .
  • **
    matches any number of consecutive characters, including the directory separator
    /
    .
  • ?
    matches a single character, excluding the directory separator
    /
    .

compression.conf example

/**/images/**/*.* none/src/client/core/lib_01.? zip
If you apply this compression filter, files such as the following don’t use compression:
  • /wwwroot/dist/images/mandatory-intermediate-directory/img.png
  • /doc/images/builder/readme.txt
Files such as the following use gzip compression:
  • /src/client/core/lib_01.c
  • /src/client/core/lib_01.h
  • /src/client/core/lib_01.o

Pattern hierarchy

UVCS uses the patterns in a file to match the path of an item. Some pattern formats take precedence over others. The following shows the hierarchy of pattern formats:
  1. Path rules
  2. Name rules
  3. Extension rules
  4. Wildcard rules

filetypes.conf example

In the following example,
/src/main/bootstrap/compile.exe
is binary because path rules take precedence. Any other
compile.exe
file, such as
/build/release/compile.exe
because of the name rule.
compile.exe:txt/src/main/bootstrap/compile.exe:bin

eolconversion.conf example

In the following example, you convert the EOL sequences to
LF
for any file under
/src/java/<subdir>/
, such as
/src/java/<subdir>/
. But because an extension rule takes precedence over a wildcard rule, you use automatic EOL conversion for any
.java
files inside
/src/java/<subdir>/
, such as
/src/java/test/complex/ExtremelyRareScenarioTest.java
.
/src/java/**/*.* LF.java:auto

Use value matching pattern files • Unity Version Control • Unity Docs