threads / discuss / 31374

diff/merge tool that ignores whitespace changes

Subject: diff/merge tool that ignores whitespace changes

## tl;dr

9 messages between Aug 28, 2012 and Sep 3, 2012.

replies: 8people: 6as markdown or json

Enrico Weigelt· Aug 28, 2012, 16:26 UTC · lore
Hi folks,

I'm looking for a diff / merge tool that treats lines with only whitespace changes (trailing or leading whitespaces, linefeeds, etc) as equal.

The goal is to make reviews as well as merging or rebasing easier when things like indentions often change.

Does anybody know an solution for that ?
thx
-- 
Mit freundlichen Grüßen / Kind regards 

Enrico Weigelt 
VNC - Virtual Network Consult GmbH 
Head Of Development 

Pariser Platz 4a, D-10117 Berlin
Tel.: +49 (30) 3464615-20
Fax: +49 (30) 3464615-59

enrico.weigelt@vnc.biz; www.vnc.de 
Stephen Bash· Aug 28, 2012, 17:40 UTC · re: Enrico Weigelt · lore

Re: diff/merge tool that ignores whitespace changes

----- Original Message -----
Show 12 quoted lines
> From: "Enrico Weigelt" <enrico.weigelt@vnc.biz>
> Sent: Tuesday, August 28, 2012 12:26:39 PM
> Subject: diff/merge tool that ignores whitespace changes
> 
> I'm looking for a diff / merge tool that treats lines with
> only whitespace changes (trailing or leading whitespaces,
> linefeeds, etc) as equal.
> 
> The goal is to make reviews as well as merging or rebasing
> easier when things like indentions often change.
> 
> Does anybody know an solution for that ?
I use kdiff3 which has the option to ignore whitespace changes (bonus: I can use it on all three major OSes as my work requires).  It's GUI based, so that could be considered a downside to some.
I usually use a combination of Git's built-in diff and kdiff to check my work.

HTH, Stephen

Matthew Caron· Aug 28, 2012, 17:41 UTC · re: Stephen Bash · lore

Re: diff/merge tool that ignores whitespace changes

On 08/28/2012 01:40 PM, Stephen Bash wrote:
Show 13 quoted lines
> ----- Original Message -----
>> From: "Enrico Weigelt" <enrico.weigelt@vnc.biz>
>> Sent: Tuesday, August 28, 2012 12:26:39 PM
>> Subject: diff/merge tool that ignores whitespace changes
>>
>> I'm looking for a diff / merge tool that treats lines with
>> only whitespace changes (trailing or leading whitespaces,
>> linefeeds, etc) as equal.
>>
>> The goal is to make reviews as well as merging or rebasing
>> easier when things like indentions often change.
>>
>> Does anybody know an solution for that ?
I'm fond of Meld.
-- 
Matthew Caron, Software Build Engineer
Sixnet, a Red Lion business | www.sixnet.com
+1 (518) 877-5173 x138 office
Stephen Bash· Aug 28, 2012, 18:08 UTC · re: Matthew Caron · lore

Re: diff/merge tool that ignores whitespace changes

----- Original Message -----
Show 14 quoted lines
> From: "Matthew Caron" <Matt.Caron@redlion.net>
> Sent: Tuesday, August 28, 2012 1:41:51 PM
> Subject: Re: diff/merge tool that ignores whitespace changes
> 
> > > I'm looking for a diff / merge tool that treats lines with only
> > > whitespace changes (trailing or leading whitespaces, linefeeds,
> > > etc) as equal.
> > >
> > > The goal is to make reviews as well as merging or rebasing easier
> > > when things like indentions often change.
> > >
> > > Does anybody know an solution for that ?
> 
> I'm fond of Meld.
I loved Meld when I was working exclusively on Linux several years ago.  Honestly I think I set up my kdiff fonts/highlight colors/etc. to be very Meld-like (unintentionally, just what "looked right").  Looking at the website, technically Meld should build/run on a variety of OSes, but at some point (lost to the sands of time) I ran into trouble which is why I switched.
Stephen
Enrico Weigelt· Sep 1, 2012, 20:11 UTC · re: Stephen Bash · lore

Re: diff/merge tool that ignores whitespace changes

<snip>

Thanks folks, but that doesn't solve my problem. I'm looking for something that's usable on command line or in scripts.

Usecase a)
* git-diff or git-format-patch or tig should not show differences
  that are only whitespace changes (eg. differing linefeeds or
  tabs vs. spaces, changed indentions, etc)
Usecase b)
* when doing merges or rebases, changes in whitespaces only should be
  either ignored or resolved fully automtically.
* For example:
  -> A changes spaces into tabs or adds leading/trailing spaces
  -> B changes some non-spaces 
cu
-- 
Mit freundlichen Grüßen / Kind regards 

Enrico Weigelt 
VNC - Virtual Network Consult GmbH 
Head Of Development 

Pariser Platz 4a, D-10117 Berlin
Tel.: +49 (30) 3464615-20
Fax: +49 (30) 3464615-59

enrico.weigelt@vnc.biz; www.vnc.de 
Torsten Bögershausen· Sep 1, 2012, 20:41 UTC · re: Enrico Weigelt · lore

Re: diff/merge tool that ignores whitespace changes

On 01.09.12 22:11, Enrico Weigelt wrote:
Show 11 quoted lines
> 
> <snip>
> 
> Thanks folks, but that doesn't solve my problem. I'm looking for something
> that's usable on command line or in scripts.
> 
> Usecase a)
> 
> * git-diff or git-format-patch or tig should not show differences
>   that are only whitespace changes (eg. differing linefeeds or
>   tabs vs. spaces, changed indentions, etc)
Would that help ?
git help diff
[snip]
     --ignore-space-at-eol
           Ignore changes in whitespace at EOL.
       -b, --ignore-space-change
           Ignore changes in amount of whitespace. This ignores whitespace at
           line end, and considers all other sequences of one or more
           whitespace characters to be equivalent.
       -w, --ignore-all-space
           Ignore whitespace when comparing lines. This ignores differences
           even if one line has whitespace where the other line has none.
Enrico Weigelt· Sep 2, 2012, 21:07 UTC · re: Torsten Bögershausen · lore

Re: diff/merge tool that ignores whitespace changes

Hi,
Show 17 quoted lines
> Would that help ?
> git help diff
> [snip]
>      --ignore-space-at-eol
>            Ignore changes in whitespace at EOL.
> 
>        -b, --ignore-space-change
>            Ignore changes in amount of whitespace. This ignores
>            whitespace at
>            line end, and considers all other sequences of one or more
>            whitespace characters to be equivalent.
> 
>        -w, --ignore-all-space
>            Ignore whitespace when comparing lines. This ignores
>            differences
>            even if one line has whitespace where the other line has
>            none.

That might be it :) Now I yet need to find out how to configure tig for it.

By the way: anything similar for merge/rebase ?
thx
-- 
Mit freundlichen Grüßen / Kind regards 

Enrico Weigelt 
VNC - Virtual Network Consult GmbH 
Head Of Development 

Pariser Platz 4a, D-10117 Berlin
Tel.: +49 (30) 3464615-20
Fax: +49 (30) 3464615-59

enrico.weigelt@vnc.biz; www.vnc.de 
Jonas Fonseca· Sep 3, 2012, 20:40 UTC · re: Enrico Weigelt · lore

Re: diff/merge tool that ignores whitespace changes

On Sun, Sep 2, 2012 at 5:07 PM, Enrico Weigelt <enrico.weigelt@vnc.biz> wrote:
Show 21 quoted lines
> Hi,
>
>> Would that help ?
>> git help diff
>> [snip]
>>      --ignore-space-at-eol
>>            Ignore changes in whitespace at EOL.
>>
>>        -b, --ignore-space-change
>>            Ignore changes in amount of whitespace. This ignores
>>            whitespace at
>>            line end, and considers all other sequences of one or more
>>            whitespace characters to be equivalent.
>>
>>        -w, --ignore-all-space
>>            Ignore whitespace when comparing lines. This ignores
>>            differences
>>            even if one line has whitespace where the other line has
>>            none.
>
> Now I yet need to find out how to configure tig for it.
Try: echo "set ignore-space = all" >> ~/.tigrc
And use 'W' to toggle between the different modes.
-- 
Jonas Fonseca
Andreas Schwab· Sep 1, 2012, 21:09 UTC · re: Enrico Weigelt · lore

Re: diff/merge tool that ignores whitespace changes

Enrico Weigelt <enrico.weigelt@vnc.biz> writes:
> * git-diff or git-format-patch or tig should not show differences
>   that are only whitespace changes (eg. differing linefeeds or
>   tabs vs. spaces, changed indentions, etc)
--ignore-all-space
Andreas.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

← back to recent threads