threads / discuss / 36227

Unexpected difference between core.autocrlf=true and .gitattributes text=auto

Subject: Unexpected difference between core.autocrlf=true and .gitattributes text=auto

## tl;dr

One message between Mar 19, 2014 and Mar 19, 2014.

replies: 0people: 1as markdown or json

Marc Strapetz· Mar 19, 2014, 13:44 UTC · lore

I have a file.txt which is stored with CRLF in the repository (I'm on Windows, but that should not matter). autocrlf has been set:

$ git config core.autocrlf true

Git considers the working tree clean:

$ touch file.txt $ git status On branch master nothing to commit, working directory clean

However, when adding .gitattributes with following content:
* text=auto
Git starts considering the file as modified:

$ touch file.txt $ git status On branch master Changes not staged for commit: ...

        modified:   file.txt

I think it's correct to consider the file as modified, because when committing it, it should be converted to CRLF.

But why doesn't it show up as modified in the first case?
-Marc

← back to recent threads