[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Trouble with diff

From: Michael Sinz <michael.sinz_at_gmail.com>
Date: 2005-03-30 17:38:20 CEST

On Wed, 30 Mar 2005 16:43:08 +0200, Marcel Broeken
<M.H.Broeken@phys.uu.nl> wrote:
> Hi everyone,
>
> This is my first mail to this mailing list, so please be gentle ;)
> I'm using svn 1.1.3 on Mac OS X and have stumbled onto a problem with
> svn diff. I've deleted three lines from input.php. These lines
> correspond to lines 198, 199 and 200 in input.php.svn-base. When I run
> svn diff it outputs input.diff. This is not what I expect which should
> include something like:
> -<p>
> -Note: <code>mum</code> stands for micrometer (&micro;m).
> -</p>
> Any thoughts?

You have a file with mixed line enders. Some lines are LF-only, some
CR-only, and some that look like CR/LF. (Note that
Unix/Linux/Mac-OSX/Amiga are all LF-Only, Dos/Windows is CR/LF, and
Mac Classic is CR-only)

This causes the SVN diff code to think that the area where you made
the change, the first <p> and the Note: line are all part of the much
larger line that shows up in the diff as the line with "maximum
supersaturation..."

Plus, if viewed on a "traditional" Unix terminal (xterm/etc) the
CR-only line enders some of the lines in the file will cause all of
the lines to pile on top of each other (CR == carriage return with no
line feed) and thus the display may not match what it actually holds.

(I don't have my Mac here so I can not tell if the same happens on a
Mac OS-X Terminal but my guess is that it would given that the OS-X
terminal conforms to POSIX escape and control sequences.)

A good way to look at what the diff really shows is with less (or at
least most less implementations) as they will show the CR characters
as ^M (and, if the terminal supports it, in bold or underlined or
inverse video - depends on the termcap settings)

So, while it may have looked funny and the handling of mixed line
ender files is really a hard problem, the net result is correct in
that the diff really shows the difference even if the difference is a
bit "bigger" than you may have thought it really would have been.

-- 
Michael Sinz               Technology and Engineering Director/Consultant
"Starting Startups"                          mailto:Michael.Sinz@sinz.org
My place on the web                      http://www.sinz.org/Michael.Sinz
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Mar 30 17:41:46 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.