Suppressing git EOL conversion for PDFs

0

I'm maintaining a git repository of PDFs, and I'm having trouble stopping gitr converting EOLs from CRLF to LF. As the repo is shared between a Linux and Windows, and contains Linux scripts, I've opted to standardise on LF for line endings.

This is reporoot/.gitattributes:

*.exe -text
*.pdf -text
* text eol=lf

This is the (relevant?) part of reporoot/.git.config:

[core]
    autocrlf = false

The pdfs are in /Reports

When committing (on Linux), I get this message:

warning: CRLF will be replaced by LF in Reports/2017-09-22.pdf. The file will have its original line endings in your working directory.

But when I pull (on Windows), the pdf is corrupt and doesn't display properly (sometimes -- I guess those that work don't have CRLFs in their data).

What am I doing wrong?

Brent.Longborough

Posted 2017-09-22T13:00:32.477

Reputation: 629

Answers

0

From the git manual:

When more than one pattern matches the path, a later line overrides an earlier line. This overriding is done per attribute.

As a result, the * text line is overriding the earlier lines.

The correct order for .gitattributes is this:

* text eol=lf
*.exe binary 
*.pdf binary

Brent.Longborough

Posted 2017-09-22T13:00:32.477

Reputation: 629