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

Re: [TESTCASE] Failing 'git am' when core.autocrlf=true

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 23, 2007, 19:44 UTC
Message-ID
<7vabsit4re.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<alpine.LFD.0.999.0708231153150.30176@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 26 quoted lines
> And the reason is really interesting: it only happens if the index file 
> has the same date as the entry in the index, in which case we end up doign 
> the "careful" check in ce_smudge_racily_clean_entry() and there the 
> "ce_modified_check_fs()" will end up re-reading the file, and if we don't 
> have the right CRLF behaviour, we will now return DATA_CHANGED.
>
> So the call-chain for this is:
>
> 	cmd_write_tree ->
> 	  write_tree ->
> 	    write_index ->
> 	      ce_smudge_racily_clean_entry -> 
> 		ce_modified_check_fs ->
> 		  ce_compare_data ->
> 		    index_fd ->
> 		      convert_to_git ->
> 			** wrong answer unless auto_crlf is set **
>
> 		and now "ce_smudge_racily_clean_entry()" will do
> 			ce->ce_size = htonl(0);
>
> and the one-liner fix I sent out is actually the right fix.
>
> This was harder to find than it should have been, because it actually 
> depends on the datestamp of the index file matching the datestamp of the 
> file in question!

Ahhhh, I forgot that we made write-tree to write back into index because at that point we have a fully populated cache-tree.

Your analysis makes sense to me.  Thanks.
Previous: Linus TorvaldsNext: Marius Storm-Olsen
Message 7 of 8 in “[TESTCASE] Failing 'git am' when core.autocrlf=true”
  1. Marius Storm-OlsenAug 23, 2007
  2. Linus TorvaldsAug 23, 2007
  3. Marius Storm-OlsenAug 23, 2007
  4. Junio C HamanoAug 23, 2007
  5. Linus TorvaldsAug 23, 2007
  6. Linus TorvaldsAug 23, 2007
  7. Junio C HamanoAug 23, 2007
  8. Marius Storm-OlsenAug 23, 2007

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.