Page Index Toggle Pages: 1 Print
Understanding a diff script (Read 1487 times)
Captain John
Ex Member


Understanding a diff script
Mar 10th, 2010 at 8:10pm
Print Post  
To read these diff files:
A line prefaced with --- indicates the old file; a line with +++ indicates the new file.  Generally, these will both have the same (or similar) filename.  Note that there may be more than one ---/+++ line per file, because multiple files may be modified.  For your purposes, you want to just pay attention to the +++ line, which indicates the file you want to edit.

Then, the @@ lines indicate the line number at which to start looking (the - number is the line in the old file, the + is for the new file).  Go to that line number, then:

Any line WITHOUT a - or + in front of it is a "context" line, i.e. it tells you what surrounds (before and after) the area you need to change; these lines are unchanged between the files.  Lines prefaced with a - or + differ between the files, where the - indicates the line in the old file, and the + indicates the line in the new file.

To put it more simply:
The +++ lines indicate the file to edit.
  Go to the line number indicated by the @@ lines, and look for the code that looks like what's in the patch.
  Remove any lines prefaced by -
  Add lines prefaced by +
  Then, save.
  (Be aware that in more complicated files, "context" lines may come between the - and + lines... the trick is just to remove - lines and add + lines, in the same order they appear in relation to the context lines.)
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Print
 
  « Board Index ‹ Board  ^Top