I am writing some tools for git that make use of smudge/clean filters, and so I must create entries in the .gitattributes
file.
Unfortunately, that file is parsed rather simply by splitting on whitespace, and so it is does not seem possible to me to include an explicit space character in the pattern.
I have been replacing whitespace characters with ?
, which matches again zero or one characters.
Ergo, a pattern of has?spaces
will match against my target filename of has spaces
, but also hasspaces
.
Is there a way to only match spaces, or am I stuck with the near-match?
You can try, as part of your pattern:
[[:space:]]
# as in
has[[:space:]]spaces
The gitattributes man page does mention an example with it.
And the pattern tests also include several examples:
match 1 x ' ' '[[:digit:][:upper:][:space:]]'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With