Re: BUG: CR marker ^M doesn't show up in '-' lines of diffs when the ending of the removed line is CR+LF
To
Frank Schäfer
Cc
Junio C Hamano
brian m. carlson
git@vger.kernel.org
From
Johannes Sixt
See Also
Prev Ref 1 Ref 2 Ref 3 Ref 4 Ref 5 Ref 6 Ref 7 Ref 8 Ref 9 Ref 10
Date
2018-12-02 21:22:32 UTC
Am 02.12.18 um 20:31 schrieb Frank Schäfer:
> Am 29.11.18 um 03:11 schrieb Junio C Hamano:
> [...]
>> This was misspoken a bit.  Let's revise it to
>>
>>   	When producing a colored output (not limited to whitespace
>>   	error coloring of diff output) for contents that are not
>>   	marked as eol=crlf (and other historical means), insert
>>   	<RESET> before a CR that comes immediately before a LF.
> You mean
>       ...
>       <RESET> *after* a CR that comes immediately before a LF."
> 
> 
> OK, AFAICS this produces the desired output in all cases if eol=lf.
> 
> Now what about the case eol=crlf ?
> Keeping the current behavior of '-' lines is correct.
> But shouldn't ^M now be suppressed in '+' lines for a consistent behavior ?

That can be achieved with whitespace=cr-at-eol.

> With other words:
> "If CR comes immediately before a LF, do the following with *all* lines:
> <RESET> after the CR if eol=lf but do not <RESET> after the CR if eol=crlf."

Why? It is the pager's duty to highlight CR, IMO. If it doesn't, but the 
user wants to see them, then they are using the wrong pager or the wrong 
pager settings.

As far as I am concerned, I do not have any of my files marked as 
eol=crlf, but I do *not* want to see ^M in the pager. I.e., having git 
insert <RESET> between CR and LF would do the wrong thing for me.

-- Hannes