Re: [SLUG] Interpret a "diff"

From: Paul Braman (aeon@tampabay.rr.com)
Date: Wed Nov 14 2001 - 18:22:55 EST


On Wed, 14 Nov 2001, Bob Stia wrote:

> Also tried the -u option but that seemed more confusing to me because
> it had a lot of stuff printed that wasn't an actual diff. This way
> though, seemed to denote the files by the "+" and "-" signs. The
> lines were broken in the exact same way though, AND there were no
> numbers at the end of the line. What do the numbers mean??

The -u option gives you a "unified context" diff which is often much
better for reading diffs once you understand the syntax. By its very name
it gives you not only the lines that have changed (the "-" denotes lines
that have been removed from the first file and the "+" denotes lines that
have been added in the second file), but it also gives you a bit of
context surrounding the change so you can see more clearly where it exists
in the files.

Okay, let's consider this one example you've given...

< # post-install snd amixer set Master 100% unmute;amixer set
PCM 100% unmute; amixer set Aux,1 100% unmute

---
> # post-install snd amixer set Master 100% unmute;amixer set
PCM 100% unmute;
> amixer set Aux,1 100% unmute

Part of the problem here is that your screen is doing a bit of wrapping for you so you might be getting confused. Consider how the output would look if you took out the leading text up to the first semicolon...

< # ;amixer set PCM 100% unmute; amixer set Aux,1 100% unmute --- > # ;amixer set PCM 100% unmute; > amixer set Aux,1 100% unmute

What this shows you is that the "left arrow" stuff (which is the first file) had a single line with all that text on it, but the "right arrow" stuff (the second file) has that same text broken into two individual lines. The break is somewhere after the second semicolon.

A unified context diff would look something like...

# lead in line 1 # lead in line 2 # lead in line 3 -# ;amixer set PCM 100% unmute; amixer set Aux,1 100% unmute +# ;amixer set PCM 100% unmute; +amixer set Aux,1 100% unmute # follower line 3 # follower line 2 # follower line 1

This basically says that the long line as been subtracted and a pair of new lines has been added in its place.

Most likely the problem here is that when the line was broken into a "second" line there was no "#" at the beginning of the second line to tell anything that it's still part of a comment block.

If you look in the first file you'll see this...

# lead in line 1 # lead in line 2 # lead in line 3 # ;amixer set PCM 100% unmute; amixer set Aux,1 100% unmute # follower line 3 # follower line 2 # follower line 1

...and if you look in the second file you'll see this...

# lead in line 1 # lead in line 2 # lead in line 3 # ;amixer set PCM 100% unmute; amixer set Aux,1 100% unmute # follower line 3 # follower line 2 # follower line 1

(Of course, this example has stripped some of *your* stuff to show the actual difference without the interference of line-wrapping on your screen.)

I hope this helps.

Paul Braman aeon@tampabay.rr.com



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 18:08:55 EDT