Spaces in .gitattributes templates

I am writing several tools for git that use smudge / clean filters , and therefore I have to create entries in a .gitattributes file.

Unfortunately, this file is parsed quite simply, breaking into spaces, and therefore it does not seem possible for me to include an explicit space character in the template.

Am I replacing whitespace characters ? which again matches zero or one character.

Ergo, the has?spaces pattern will match my target has spaces file name, but also hasspaces .

Is there a way to combine spaces, or am I sticking to a close match?

+6
source share
1 answer

You can try as part of your template:

 [[:space:]] # as in has[[:space:]]spaces 

The gitattributes man page points to an example with it .
And the template tests also include a few examples :

 match 1 x ' ' '[[:digit:][:upper:][:space:]]' 
+5
source

Source: https://habr.com/ru/post/954037/


All Articles