.gitattributes not setting attr 'text eol' properly

279 views Asked by At

Sample from .gitattributes file that was recently committed.

* text=auto eol=lf
*.bat text eol=crlf
*.cmd text eol=crlf
*.ahk text eol=crlf
*.ps1 text eol=lf

Current output of git ls-files --eol below. Note that file a.ps1 is currently a newly created staged file and file b.ps1 was added in a previous commit when *.ps1 text eol=crlf existed in the .gitattributes file.

i/lf    w/lf    attr/text eol=crlf      a.ps1
i/lf    w/crlf  attr/text eol=crlf      b.ps1

Expected output of git ls-files --eol below

i/lf    w/lf  attr/text eol=lf      a.ps1
i/lf    w/lf  attr/text eol=lf      b.ps1

I can correct the w/ line ending to lf by just manually changing the local files, but why does it not say attr/text eol=lf?

Does someone happen to know what is happening? OS is windows, if that matters. Thanks for your time.

1

There are 1 answers

1
acegene On

I found a solution, although at this time I am not sure what really happened.

I use git submodules. Top level git repo A had submodule B; B is the repo mentioned in this question. There was a file A/.git/modules/B/info/attributes that was an older version of my B/.gitattributes file. Deleting this old file allowed B/.gitattributes to be utilized and for attr/text eol=lf to be set appropriately for a.ps1 and b.ps1.