All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Marius Storm-Olsen <marius@trolltech.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [TESTCASE] Failing 'git am' when core.autocrlf=true
Date: Thu, 23 Aug 2007 12:44:37 -0700	[thread overview]
Message-ID: <7vabsit4re.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <alpine.LFD.0.999.0708231153150.30176@woody.linux-foundation.org> (Linus Torvalds's message of "Thu, 23 Aug 2007 12:23:39 -0700 (PDT)")

Linus Torvalds <torvalds@linux-foundation.org> writes:

> 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.

  reply	other threads:[~2007-08-23 19:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-23 14:07 [TESTCASE] Failing 'git am' when core.autocrlf=true Marius Storm-Olsen
2007-08-23 17:18 ` Linus Torvalds
2007-08-23 17:45   ` Marius Storm-Olsen
2007-08-23 18:41   ` Junio C Hamano
2007-08-23 19:25     ` Linus Torvalds
2007-08-23 19:23   ` Linus Torvalds
2007-08-23 19:44     ` Junio C Hamano [this message]
2007-08-23 20:11     ` Marius Storm-Olsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vabsit4re.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=marius@trolltech.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.