git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Marc Strapetz <marc.strapetz@syntevo.com>
Date
Mar 19, 2014, 13:44 UTC
Message-ID
<53299F4A.6000600@syntevo.com>

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
Message 1 of 1 in “Unexpected difference between core.autocrlf=true and .gitattributes text=auto”
  1. Marc StrapetzMar 19, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.