Re: [PATCH v1 1/1] correct apply for files commited with CRLF

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

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> The "previous" in the context of running "git apply" (which does not
> look at the index) is _not_ what is in the index, on the other hand.
> Instead of "struct index_state *", convert_to_git() needs to be
> fixed to take something else that can be queried for the "previous"
> version to use as a hint, if "safe CRLF" wants to work correctly.

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.

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.




[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