[comp.sources.d] how to make a patch for hierarchy?

dfk@dukvlsi2.cs.duke.edu (David F. Kotz) (07/18/88)

I have a program whose sources are arranged in a tree of directories.
I made some changes, and I want to make a "patch" to distribute the
changes. How does one go about making a patch file for this situation? 

If the original is in old/ and the new version is in new/, I tried

cd new
diff -c -r ../old . > ../patchfile

but patch (applied with (cd old; patch <../patchfile) complained
whenever a file in a subdirectory was changed; it prompted for the
name of the file to patch. 

Is this impossible? Do I need to flatten the tree?

David Kotz
Department of Computer Science, Duke University, Durham, NC 27706
ARPA:	dfk@cs.duke.edu
CSNET:	dfk@duke        
UUCP:	decvax!duke!dfk

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (07/19/88)

In article <12041@duke.cs.duke.edu> dfk@dukvlsi2.cs.duke.edu (David F. Kotz) writes:
: I have a program whose sources are arranged in a tree of directories.
: I made some changes, and I want to make a "patch" to distribute the
: changes. How does one go about making a patch file for this situation? 

Patch can patch files in subdirectories as long as two conditions hold:

1) You generate the patch such that the subdirectories are included as
part of the filenames on the *** or --- lines of a context diff, or an
Index: line with other kinds of diffs.  (It looks like your diff file
satisfied this condition.)

2) The person applying the patch has to say "patch -p" to tell patch to
pay attention to the pathnames.  (I think this is all you needed.)

Larry Wall
lwall@jpl-devvax.jpl.nasa.gov