git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: BUG: CR marker ^M doesn't show up in '-' lines of diffs when the ending of the removed line is CR+LF

From
Johannes Sixt <j6t@kdbg.org>
Date
Dec 5, 2018, 21:31 UTC
Message-ID
<337ed78c-afd5-24ab-709b-ff74ee6b90ac@kdbg.org>
In-Reply-To
<de3bd8e1-cdd7-5fcf-0912-a216cc8cb3e9@googlemail.com>
Am 05.12.18 um 20:29 schrieb Frank Schäfer:
Show 12 quoted lines
> 
> Am 02.12.18 um 22:22 schrieb Johannes Sixt:
>> Am 02.12.18 um 20:31 schrieb Frank Schäfer:
>>> 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.
> AFAIU Junios explanation it's not the pagers fault.

Then Junio and I are in disagreement. IMO, Git does not have to be more clever than the pager when it comes to presentation of text.

Show 5 quoted lines
>> 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.
>>
> But doing the same thing in added lines is doing the right thing for you ?

Yes, I think so. As long as I'm not telling Git that my files are CRLF when they actual are, then the CR before LF is a whitespace error. Nevertheless, I do *NOT* want Git to outwit my pager by inserting <RESET> between CR and LF all the time so that it is forced to treat the lone CR like a control character that is to be made visible.

> Or are you suggesting to fix the behavior of added lines instead ?
> In any case, inconsistent behavior is not what we want.

I'm suggesting that users who knowingly store CRLF files in the database, but do not want to see ^M in added lines have to use whitespace=cr-at-eol and that's all. I do not see inconsistency.

-- Hannes
Previous: Frank SchäferNext: Junio C Hamano
Message 18 of 23 in “BUG: CR marker ^M doesn't show up in '-' lines of diffs when the ending of the removed line is CR+LF”
  1. Frank SchäferNov 23, 2018
  2. Johannes SixtNov 23, 2018
  3. Frank SchäferNov 24, 2018
  4. Torsten BögershausenNov 24, 2018
  5. Johannes SixtNov 24, 2018
  6. Frank SchäferNov 25, 2018
  7. Johannes SixtNov 25, 2018
  8. Junio C HamanoNov 26, 2018
  9. brian m. carlsonNov 25, 2018
  10. Johannes SixtNov 26, 2018
  11. Junio C HamanoNov 26, 2018
  12. Johannes SixtNov 27, 2018
  13. Frank SchäferNov 27, 2018
  14. Junio C HamanoNov 29, 2018
  15. Frank SchäferDec 2, 2018
  16. Johannes SixtDec 2, 2018
  17. Frank SchäferDec 5, 2018
  18. Johannes SixtDec 5, 2018
  19. Junio C HamanoDec 3, 2018
  20. Frank SchäferDec 5, 2018
  21. Junio C HamanoDec 6, 2018
  22. Frank SchäferDec 6, 2018
  23. Frank SchäferNov 27, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.