git-blame issue (with fix)

Hi all,

When running:

1
git blame  code/win32_handmade.cpp
.. from the top level directory of a clone of the new 'cpp' git repo, I see:

1
00000000 (Not Committed Yet 2015-09-05 15:59:34 -0400

... reported for every line.

Here's what I suspect is happening: git-blame compares a CRLF file (in the git object database) to an LF file (the temporary result of passing the file in the worktree through the CRLF-to-LF conversion), so it presents all lines as modified in the worktree (even though the file in the worktree remains in CRLF format, unchanged, and identical to the database object).

To fix this on Windows, we can configure git to not do that conversion for this repository:
1
2
3
w:
cd \handmade
git config core.autocrlf false

(Setting autocrlf 'input' doesn't seem to work, though it should.)

Tested with git version 2.5.1.windows.1

On unixy machines, there doesn't seem to be a problem: files get checked out to the worktree in CRLF format and git-blame gives the right output. YMMV.