[jdbc] How to make those patch thinggies

Bob Kline bkline at rksystems.com
Wed Aug 2 17:43:08 EDT 2000

On Wed, 2 Aug 2000, Maraya Michael wrote:

> Now if someone can tell me how to assimilate someone else's patch
> into your local copy of the repository (resistance is futile), I'll
> be able to tell you what to do with those patch thinggies.

The patch utility is the tool here.  Try 'man patch' for fuller
instructions, but basically you just type

    $ patch -pN < PATCHFILE

where N is a number representing the number of subdirectory levels which
need to be stripped from the pathnames given in the patchfile in order
for the utility to be able to find the files it needs to patch, relative
to your current working directory, and PATCHFILE is the name of the file
containing the patches.  For example, if you look at the patches I most
recently posted, you'll see the following two lines near the top:

--- original/ParameterUtils.java        Mon Jul 17 00:41:05 2000
+++ modified/ParameterUtils.java        Wed Aug  2 12:06:36 2000

So you would navigate to the directory which has the ParameterUtils.java
file in it (probably ..../freetds_jdbc) and issue the command:

    $ patch -p1 < ParameterUtils.diff

... assuming that's what you named the diff output I posted.  The option
-p1 reflects the fact that you want patch to strip off the "original/"
and "modified/" pathname prefixes, which has one (1) unwanted level of
depth to the path.  If it said "bob/src/original/ParameterUtils.java"
and "bob/src/modified/ParameterUtils.java" you would instead use -p3
because there are three superfluous levels to be stripped (count the
slashes).  On the other hand, if you have "original/unittests/Makefile"
then you only want to use "-p1" because you need to preserve the
"unittests/" portion (and you need to be positioned in the parent
directory of unittests).

Make any sense?

Bob Kline
mailto:bkline at rksystems.com

More information about the FreeTDS mailing list