[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: extend diff3 to ignore whitespace differences - here's a patch
From: |
John Lumby |
Subject: |
Re: extend diff3 to ignore whitespace differences - here's a patch |
Date: |
Thu, 04 Dec 2003 18:09:07 -0500 |
Thanks for the reply. Yes, certainly. I'll try to describe the problem
I've faced numerous times with diff3. It's the usual situation where I
have made changes to version N and now want to merge them into version N+1.
Very often, the changes between N -> N+1 include minor reformatting
changes, and sometimes I've also made such trivial changes in amongst the
changes I've made. I ran into just such a set recently. Whenever a
"significant" change of mine conflicts with a trivial reformatting change in
N -> N+1, I want diff3 to ignore the trivial change and accept mine without
flagging a conflict. Similarly, where a trivial change of mine conflicts
with a significant change in N -< N+1, I want to discard my trivial change.
That's what this -w option does (well, I think it does).
In practice I find that with this -w option, it reduces the number of
conflicts quite dramatically.
Of course, this is not completely harmless - (some of) both my and the other
guy's trivial changes are lost in the process. However, this gives me
the option to get something working much sooner. Maybe later on I'll go
back and reinstate the trivial changes, depending on what I'm doing it for.
Moreover, very often these trivial changes are not put in by humans
(manually) they are from some auto-indenter/tidier, and after I've finished
getting my code working I can simply switch to whatever indenter I prefer or
am asked to follow, and tell it to tidy the whole file. I don't want to
be confronted with any of that.
Here's an example from very recently of a fragment of emacs xfns.c that
illustrates the problem. If you put these three in files and try diff3'ing
them with and without the -w you'll see what I mean.
I hope my and your e-mailer respects tabs - "mine" has no tabs, "older has
leading tabs on lines 2, 3, 6 and 7 : "yours" also has those tabs and tabs
on lines 4 and 5 as well. result - diff3 without -w sees a 3-way
conflict.
John
mine:
#if 0 /* I don't know why it did this,
but it seems logically wrong,
and it causes trouble for MapNotify events. */
/* Match if the window is this frame's menubar. */
if (x->menubar_widget
&& wdesc == XtWindow (x->menubar_widget))
return f;
#endif
older:
#if 0 /* I don't know why it did this,
but it seems logically wrong,
and it causes trouble for MapNotify events. */
/* Match if the window is this frame's menubar. */
if (x->menubar_widget
&& wdesc == XtWindow (x->menubar_widget))
return f;
#endif
yours:
#if 0 /* I don't know why it did this,
but it seems logically wrong,
and it causes trouble for MapNotify events. */
/* Match if the window is this frame's menubar. */
if (x->menubar_widget
&& wdesc == XtWindow (x->menubar_widget))
return f;
#endif
Original Message Follows----
From: Paul Eggert <address@hidden>
To: "John Lumby" <address@hidden>
CC: address@hidden
Subject: Re: extend diff3 to ignore whitespace differences - here's a patch
Date: 03 Dec 2003 15:19:12 -0800
Can you give an example of why this change is helpful?
What does it really mean for diff3 to ignore white space differences?
I.e., can you explain in general what diff3 should do, when given a
"diff" option that ignores some differences? I'm looking for
documentation here, more than code.
_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=dept/features&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca