Thread (13 messages) flat view 13 messages, 2 authors, 2017-08-17

Re: core.autocrlf=true causes `git apply` to fail on patch generated with `git diff-index HEAD --patch`

From: Torsten Bögershausen <hidden>
Date: 2017-08-12 05:53:47

Possibly related (same subject, not in this thread)

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.
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,
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help