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

git status internals and line endings

From
Marc Strapetz <marc.strapetz@syntevo.com>
Date
Nov 12, 2009, 20:32 UTC
Message-ID
<4AFC70CE.5020106@syntevo.com>

I'm trying to figure out under which circumstances changes in line endings are resulting in 'modified' status (resp. will be committed). I have three files with the same content, differing only in line endings:

- file1 is committed with CRLF and has LF in working tree
- file2 is committed with CRLF and has CRLF in working tree
- file3 is committed with LF and has CRLF in working tree

On Linux, file1 and file3 are reported as modified -- as I would expect. The surprise is on Windows: here only file1 is reported as modified. Why not file3? Btw, 'git hash-object file3' reports the same SHA as for the LF-only content in the repository (not so on Linux, as expected).

Is this some special handling on Windows (and possibly on Mac OS)? In this case, can someone please point me to the corresponding code part? Thanks for any comments regarding this topic.

-- Best regards, Marc Strapetz ============= syntevo GmbH http://www.syntevo.com http://blog.syntevo.com

Next: Jeff King
Message 1 of 6 in “git status internals and line endings”
  1. Marc StrapetzNov 12, 2009
  2. Jeff KingNov 13, 2009
  3. Marc StrapetzNov 13, 2009
  4. Erik Faye-LundNov 13, 2009
  5. Marc StrapetzNov 13, 2009
  6. Peter KreftingNov 13, 2009

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.