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

Re: git-diff cr/nl files on linux

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
May 26, 2008, 08:04 UTC
Message-ID
<fcaeb9bf0805260104p72828318p202d3bceaa676daa@mail.gmail.com>
In-Reply-To
<483A59FD.6020906@viscovery.net>
On Mon, May 26, 2008 at 1:34 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
Show 39 quoted lines
> Nguyen Thai Ngoc Duy schrieb:
>> On Sat, May 24, 2008 at 8:01 PM, Dirk Süsserott <newsletter@dirk.my1.cc> wrote:
>>> Nguyen Thai Ngoc Duy schrieb:
>>>> Hi,
>>>>
>>>> Is there any way that can make git-diff show cr/nl ending files on
>>>> linux without ^M at the end?
>>>>
>>>> Thanks
>>>>
>>> What about 'git diff -w'? It drops any whitespace changes, including ^M's.
>>> Not sure whether that is what you meant.
>>
>> That won't help. Here is a snippet of what I see:
>>
>> diff --git a/abc.c b/abc.c
>> index 064a769..647b9ae 100644
>> --- a/abc.c
>> +++ b/abc.c
>> @@ -859,7 +859,10 @@ int def
>>      )
>>      {
>>      FAST int asdsa;
>> -    FAST int dsdsad;
>> +    FAST int dsadadd;          /* ERROR also means AASAS */^M
>> +#ifndef JHASHJJH^M
>> +    struct sdddd dasdada;^M
>> +#endif^M
>>      union sddd asdsdad;
>>      FAST STATUS dsadadad;
>>      unsigned int sdadadad = 0;
>>
>> With color turning off, it does not show ^M so probably something to
>> do with the coloring. less is at version 394.
>
> less does not show \r if it comes right before \n. But with diff-coloring
> turned on, the 'reset color' sequence is inserted between \r and \n; now
> less shows ^M for the \r because it's not next to the \n anymore.
>

Right. And setting core.whitespace = cr-at-eol fixes it (although difficult to find). Thank you all.

> -- Hannes
>
-- 
Duy
Previous: Johannes Sixt
Message 6 of 6 in “git-diff cr/nl files on linux”
  1. Nguyen Thai Ngoc DuyMay 24, 2008
  2. Dirk SüsserottMay 24, 2008
  3. Nguyen Thai Ngoc DuyMay 26, 2008
  4. Junio C HamanoMay 26, 2008
  5. Johannes SixtMay 26, 2008
  6. Nguyen Thai Ngoc DuyMay 26, 2008

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.