From: Junio C Hamano Date: Tue, 27 Dec 2016 17:27:22 GMT Subject: Re: git-apply: warn/fail on *changed* end of line (eol) *only*? Message-ID: In-Reply-To: Junio C Hamano writes: > Imagine that the project wants LF line endings, i.e. it considers > that a line with CRLF ending has an unwanted "whitespace" at the > end. Now, you start from this source file: > > 1 > 3 > 5 > > and a patch like this comes in: > > 1 > -3 > +three > 5 > > You think that "3 " was replaced by "three ", and the > claim is "the 'previous' contents already had ending, so the > change is not making things worse". To see the problem with "check existing lines", it probably is easier to extend the above example to start from a file with one more line, like this: 1 3 4 5 and extend all the example patches to remove "4 " line as well, where they remove "3 ", making the first example patch like so: 1 -3 -4 +three 5 Now, if you take "three " to be replacing "3 ", then you may feel that not warning on the CRLF would be the right thing, but there is no reason (other than the fact you, a human, understand what 'three' means) to choose "3 " over "4 " as the original. If you take "three " to be replacing "4 ", you would need to warn. A totally uninteresting special case is when the original is all , but in that case, as you already said in the original message, the project wants and you can configure it as such. Then in the line-end won't be mistaken as if it is a whitespace character at the end of a line terminated with .