git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-diff cr/nl files on linux
@ 2008-05-24 12:54 Nguyen Thai Ngoc Duy
  2008-05-24 13:01 ` Dirk Süsserott
  0 siblings, 1 reply; 6+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2008-05-24 12:54 UTC (permalink / raw)
  To: Git Mailing List

Hi,

Is there any way that can make git-diff show cr/nl ending files on
linux without ^M at the end?

Thanks
-- 
Duy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git-diff cr/nl files on linux
  2008-05-24 12:54 git-diff cr/nl files on linux Nguyen Thai Ngoc Duy
@ 2008-05-24 13:01 ` Dirk Süsserott
  2008-05-26  4:15   ` Nguyen Thai Ngoc Duy
  0 siblings, 1 reply; 6+ messages in thread
From: Dirk Süsserott @ 2008-05-24 13:01 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: Git Mailing List

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git-diff cr/nl files on linux
  2008-05-24 13:01 ` Dirk Süsserott
@ 2008-05-26  4:15   ` Nguyen Thai Ngoc Duy
  2008-05-26  4:37     ` Junio C Hamano
  2008-05-26  6:34     ` Johannes Sixt
  0 siblings, 2 replies; 6+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2008-05-26  4:15 UTC (permalink / raw)
  To: Dirk Süsserott; +Cc: Git Mailing List

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.
-- 
Duy

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: git-diff cr/nl files on linux
  2008-05-26  4:15   ` Nguyen Thai Ngoc Duy
@ 2008-05-26  4:37     ` Junio C Hamano
  2008-05-26  6:34     ` Johannes Sixt
  1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2008-05-26  4:37 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: Dirk Süsserott, Git Mailing List

"Nguyen Thai Ngoc Duy" <pclouds@gmail.com> writes:

> On Sat, May 24, 2008 at 8:01 PM, Dirk Süsserott <newsletter@dirk.my1.cc> wrote:
> ...
>> 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.

Just like GNU diff, the only thing -w (and -b) does is to omit hunks whose
changes consist of _only whitespace changes_ and nothing else.

In your quoted example, you have changes other than whitespace changes, so
it is unsurprising that you will see the whole change, together with your
whitespace changes.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git-diff cr/nl files on linux
  2008-05-26  4:15   ` Nguyen Thai Ngoc Duy
  2008-05-26  4:37     ` Junio C Hamano
@ 2008-05-26  6:34     ` Johannes Sixt
  2008-05-26  8:04       ` Nguyen Thai Ngoc Duy
  1 sibling, 1 reply; 6+ messages in thread
From: Johannes Sixt @ 2008-05-26  6:34 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: Dirk Süsserott, Git Mailing List

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.

-- Hannes

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git-diff cr/nl files on linux
  2008-05-26  6:34     ` Johannes Sixt
@ 2008-05-26  8:04       ` Nguyen Thai Ngoc Duy
  0 siblings, 0 replies; 6+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2008-05-26  8:04 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Dirk Süsserott, Git Mailing List

On Mon, May 26, 2008 at 1:34 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-05-26  8:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-24 12:54 git-diff cr/nl files on linux Nguyen Thai Ngoc Duy
2008-05-24 13:01 ` Dirk Süsserott
2008-05-26  4:15   ` Nguyen Thai Ngoc Duy
2008-05-26  4:37     ` Junio C Hamano
2008-05-26  6:34     ` Johannes Sixt
2008-05-26  8:04       ` Nguyen Thai Ngoc Duy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).