Re: core.autocrlf=true causes `git apply` to fail on patch generated with `git diff-index HEAD --patch`
- From
Torsten Bögershausen <tboegi@web.de>
- Date
- Aug 12, 2017, 05:53 UTC
- Message-ID
- <20170812055335.GB21232@tor.lan>
- In-Reply-To
- <20170812053944.GA21232@tor.lan>
>I left it unsaid by mistake, but I think the right thing to use as >the "previous" to take hint from in the context of "git apply" is >what is in the working tree, i.e. the result of applying patch in >step (4) to create a file F in the sample scenario.
Show 6 quoted lines
>While applying patch in step (5), convert_to_git() should "imagine" >adding the file F currently in the working tree (i.e. the result of >step (4)) to the index---if the resulting object in the index would >have CR, then the safe CRLF logic should refrain from doing CRLF->LF >conversion. And it should do so without actually adding neither the >preimage or the postimage to the index, of course.
(Sorry for the test mail)
What I wanted to say is that this long explanation convinced me to write a patch and send it out the next days,
Show 5 quoted lines
>When we are doing "git apply --index", then we _require_ that the >indexed contents and what is in the working tree matches before >applying the patch, so it is perfectly fine to let convert_to_git() >to look at the current index---that is the "previous" one we want to >take hint from while using the safe CRLF logic.