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

Re: git blame breaking on repository with CRLF files

From
Torsten Bögershausen <tboegi@web.de>
Date
Aug 8, 2015, 05:58 UTC
Message-ID
<55C59A9B.9000808@web.de>
In-Reply-To
<B0BFE3BB9B3E8C4A890D53FA460552D3737328B0@DEWDFEMB16B.global.corp.sap>
On 2015-08-07 18.32, Benkstein, Frank wrote:
Show 19 quoted lines
> Hello,
> 
> I am working working on Linux and am examining code in a git repository I do
> not know much about.  I am only looking at files, not changing anything.  On
> some files in the repository I get "00000000 (Not Committed Yet" for all lines
> when running "git blame".  I checked with "git status", "git reset", "git
> clean" that the files are indeed in the repository and unmodified.  I noticed
> that this only happens with git v2.5.0.  With git v2.4.0 it looks correct, i.e.
> the output has proper commit ids, Author names and dates..  With "git bisect" I
> tracked this down to the following commit:
> 
>  commit 4bf256d67a85bed1e175ecc2706322eafe4489ca (HEAD, refs/bisect/bad)
>  Author: Torsten Bögershausen <tboegi@web.de>
>  Date:   Sun May 3 18:38:01 2015 +0200
> 
>      blame: CRLF in the working tree and LF in the repo
> 
> Digging further, it seems that most files in the repository are checked in with
> CRLF line endings.  In my working tree these are checked out as LF

Do I understand it right that you have files in the repo with CRLF ? And these files are checked out with LF in the working tree ? Are the files marked with .gitattributes ? Or does the file have mixed line endings ?

(Unless I missed something: Git never strips CRLF into LF at checkout, so I wonder how you ended up in this situation)

Is there a way to reproduce it?
 - which
Show 7 quoted lines
> seems to be the exact opposite situation of what the commit is trying to
> address.  When I set "core.autocrlf" to "false" I also get the correct behavior
> of "git blame" - this is a workaround as long as I do not have to actually
> modify anything.
> 
> Best regards,
> Frank.
Previous: Benkstein, FrankNext: Torsten Bögershausen
Message 2 of 7 in “git blame breaking on repository with CRLF files”
  1. Benkstein, FrankAug 7, 2015
  2. Torsten BögershausenAug 8, 2015
  3. Torsten BögershausenAug 9, 2015
  4. Benkstein, FrankAug 10, 2015
  5. brian m. carlsonAug 10, 2015
  6. Junio C HamanoAug 10, 2015
  7. Torsten BögershausenAug 10, 2015

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.