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

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

 



Linus Torvalds wrote:
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!

Thanks for the detailed analysis of the chain of events. It
really helps understand the inner-workings of Git.

I also tried to track this down after your initial patch, but
couldn't find it. The fact that the index is smudged at the time of
the second commit, so the third failed, made me look in the wrong
place.

How about adding a trace for the smudged case, so it's easier to
find similar issues in the future?

--
.marius


From b858610ff4cd42f57a05c815a3e3b43428d67f99 Mon Sep 17 00:00:00 2001
From: Marius Storm-Olsen <mstormo_git@xxxxxxxxxxxxxxx>
Date: Thu, 23 Aug 2007 22:03:35 +0200
Subject: [PATCH] Add a trace to more easily show that the index has been smudged.

Signed-off-by: Marius Storm-Olsen <mstormo_git@xxxxxxxxxxxxxxx>
---
read-cache.c |    1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/read-cache.c b/read-cache.c
index 849e8d6..000451c 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1088,6 +1088,7 @@ static void ce_smudge_racily_clean_entry(struct cache_entry *ce)
		 * for "frotz" stays 6 which does not match the filesystem.
		 */
		ce->ce_size = htonl(0);
+		trace_printf("trace: index: Index object for '%s' smudged due to being racily clean\n", ce->name);
	}
}

--
1.5.3.rc4.mingw.2.3.g3318a-dirty


Attachment: signature.asc
Description: OpenPGP digital signature


[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