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 11:41:34 -0700 [thread overview]
Message-ID: <7vhcmqt7oh.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <alpine.LFD.0.999.0708230956190.30176@woody.linux-foundation.org> (Linus Torvalds's message of "Thu, 23 Aug 2007 10:18:54 -0700 (PDT)")
Linus Torvalds <torvalds@linux-foundation.org> writes:
> On Thu, 23 Aug 2007, Marius Storm-Olsen wrote:
>>
>> I have an issue with git-rebase failing on a repository using
>> core.autocrlf=true
>>
>> I've tracked it down to git-am failing with core.autocrlf=true and passing
>> with core.autocrlf=false. I've tried digging deeper into the code, but for
>> some reason ce_match_stat_basic() (read-cache.c:~187) reports the size of the
>> file in the index to be 0 (when core.autocrlf=true), which is why git-am bails
>> out on the patch. (ce->ce_size == 0, while st->st_size == the correct size on
>> disk)
>
> Very interesting.
> ...
> trace: built-in: git 'apply' '--allow-binary-replacement' '--index' '.dotest/patch'
> trace: built-in: git 'diff' '--quiet'
> trace: built-in: git 'diff' '--quiet'
> trace: built-in: git 'write-tree'
> trace: built-in: git 'diff' '--quiet'
>
> ie everything was fine after the "apply" phase, but the index and the
> working tree went out-of-kilter after "git write-tree".
>
> The reason? "git write-tree" doesn't read the config file, so it never
> even reads the "core.autocrlf=true" variable. As a result, it seems to
> screw up the index matching when it does the cache_tree_fully_valid()
> (which will fail due to "git apply --index" having invalidated the tree
> SHA1's) followed by cache_tree_update().
>
>> Can anyone please enlighten me on why this may happen?
>
> This patch should fix it.
>
> 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.
As you said, there is something else going on. write-tree is
about reading the index entries and writing them out as a set of
trees, and at that point it should not even matter if you have
garbage in the work tree or if you do not even have a work tree.
All the crlf conversions have been done when the object hit the
index, so its reading or not reading core.autocrlf should not
change its behaviour.
next prev parent reply other threads:[~2007-08-23 18:42 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 [this message]
2007-08-23 19:25 ` Linus Torvalds
2007-08-23 19:23 ` Linus Torvalds
2007-08-23 19:44 ` Junio C Hamano
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=7vhcmqt7oh.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).