Date: Fri, 11 Nov 2005 23:04:17 +0200 From: Leonidas Tsampros <ltsampros@upnet.gr> To: Leonidas Tsampros <ltsampros@upnet.gr> Cc: Steve Bertrand <iaccounts@ibctech.ca>, 'FreeBSD Questions' <questions@freebsd.org> Subject: Re: Understanding a patch file [OT?] Message-ID: <20051111210417.GA76076@bifteki.lan> In-Reply-To: <20051111205338.GA75629@bifteki.lan> References: <20051111181620.B684443D5D@mx1.FreeBSD.org> <20051111205338.GA75629@bifteki.lan>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Nov 11, 2005 at 10:53:38PM +0200, Leonidas Tsampros wrote: > On Fri, Nov 11, 2005 at 01:16:15PM -0500, Steve Bertrand wrote: > > Hi everyone... > > > > This may be off-topic, but I know someone may be able to help. I am > > trying to better understand how to use diff, and moreso, understand it's > > output. > > > > In particular, I can't quite grasp exactly what the identifiers in > > between @@ and @@ represent exactly. Here is a patch file I created. The > > first change looks like it will replace lines 1 through 5, but then I > > look at the second change, and it completely confuses me (-11,6 +11,8). > > Can someone please clarify why 11 and 8? > > > > I think this kind of diff output is called "unified". It displays > "hunks" of differences while each hunk shows one aera where the file > differs. > > > --- randbak.pl Wed Oct 12 17:27:10 2005 > > +++ randbak2.pl Fri Nov 11 13:06:51 2005 > > According to "info diff", the file displayed here is the file > modification time. Correcting what i just wrote : According to "info diff", the *time* displayed here is the file's modification time. > > @@ -1,5 +1,5 @@ > > #!/usr/bin/perl > > - > > +# > > use warnings; > > use strict; > > use Storable; > > This is the first hunk of changes between the files. The number -1,5 > is the line range in the first file while +1,5 is the file range on > the second file . But 1,5 doesn't mean all lines between line 1 and > line 5. It means in line 1 , + 5 lines afterward. (consider 5 as the > length of the compared regions) > > In this hunk you can see clearly that you removed a whiteline and you > add a comment line, so the total numbers of line in both files are > exactly the same. Thus you've got -1,5 +1,5. The length of the > compared region in boths files did not change. > > If the second number is different, like in the following hunk, then > the data displayed are lines 11-16 on the first file (-11,6) and > because you added two lines (the ones starting with +) the file range > of the compared region in the second file is 11-18 (+11,8) > > > I hope this helps and i'm terribly sorry for my english. Alternatively > you can check `info diff' for more information on diff different kinds > of output. > > > @@ -11,6 +11,8 @@ > > my $num; > > my $sum = "sum"; > > my $total = 0; > > + > > +# Test > > > > if (-e "randomcount"){ > > $href = retrieve ("randomcount"); > > > > > > Thank you for any advice! > > Steve > > > > _______________________________________________ > > freebsd-questions@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051111210417.GA76076>