7

I've read the documentation on .gitattributes and searched Stack Overflow for a simple answer to this question, but so far haven't found it. I have a file with spaces in it like so.

Reserved\ Slots.txt merge=mergeslots

I have also tried to use quotes instead of escaping the space.

"Reserved Slots.txt" merge=mergeslots

How do I use a custom merge driver for a file with spaces in it?

PatPeter
  • 394
  • 2
  • 17
  • It should work as presented: ["Patterns that begin with a double quote are quoted in C style."](https://git-scm.com/docs/gitattributes) – user2864740 Sep 26 '18 at 02:10
  • Is that the exact filename? With a *real space* (code=32)? Sometimes Windows uses 'not real spaces'.. – user2864740 Sep 26 '18 at 02:11
  • @user2864740 `mergeslots` is a Python file that should output it the console what it's doing, but I still get `CONFLICT (content): Merge conflict in Reserved Slots.txt` which should not be occurring. – PatPeter Sep 26 '18 at 02:32
  • The file was also created on an Ubuntu instance automatically by a program and then being merged in a Docker instance. – PatPeter Sep 26 '18 at 02:33
  • I just checked the output of another Docker instance and now I'm seeing `Slots.txt" is not a valid attribute name: .gitattributes:3`. – PatPeter Sep 26 '18 at 02:36
  • 1
    Struggling with this too. It seems a mess. On linux, escaping the space with backslash seems to be required. On windows, you have to quote the string that contains a space. Doesn't make any sense. – aggieNick02 Dec 12 '18 at 22:39

1 Answers1

6

According to Whitespace in .gitattributes patterns use

[[:space:]]
# as in
has[[:space:]]spaces
Walter Laan
  • 2,956
  • 17
  • 15