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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Thu, 23 Aug 2007, Linus Torvalds wrote:
> 
> Junio - it fixes the test for me, but quite frankly, I don't see why 
> write-tree would *ever* change any non-tree index entries. But it does. I 
> think there's another bug somewhere, or I'm missing something.

Looking more carefully at the index file before and after, the _only_ 
difference really is the ce_size field for "foo".

In the fixed one, ce_size remains at 5 (which is correct: the file 
contents are "bar\n\r"), in the broken case it gets zeroed by 
git-write-tree for some reason.

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!

		Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux