Submitting a Patch

The very short answer is diff -u or better, cvs diff -u and in either case you should then inspect the resulting patch file to insure that it is what you expect and manually remove any changes which should not be part of the submitted patch. For people not using GNU diff, -u and -N may not work, use -c for context diffs, and diff /dev/null filename to generate a diff to create a file.

The best way: Make changes in a current cvs checkout

If you have made changes in a cvs checkout just type

cvs diff -Nu package-dir > patch-file
in the package /web/openacs-4/package directory to generate the patch (see below if you have also added files).

The bad way

If you are working from code that is not a cvs checkout (definitely less desirable, see below) then you should type either:

diff -u package-dir/.../old-file package-dir/.../new-file > patch-file
or if you have modified more than one file you might want to do
diff -rNu old-package-dir new-package-dir > patch-file
which will do a recursive context diff of the old directory versus the new directory (the -r flag) and generate patches which will create new files if you have added files (the -N flag).

Gory Details

General

We prefer patches be generated from the top-level directory of the package so that it is clear from the patch where the file belongs.

The -N flag will generate a chunk in the patch file to create any new files you have added but please be careful that the files that will created really should be part of the patch. It is easy to have editor backup file and others show up (although cvs diff generally does not have this problem).

Try to avoid reformatting large blocks of code unless absolutely necessary. It is quite important that the changes be as small as possible so the patch maintainer can inspect the patch quickly and apply it if needed.

cvs diff

If you have cvs commit and are going to commit your changes but want to produce a diff for documentation purposes you should cvs add any new files you have made first so that cvs diff will produce a diff which will create the new files.

If you are working from an anonymous checkout you should do the following to add diffs for new files to the patch file: diff -u /dev/null package-dir/.../new-file >> patch-file

Non-cvs checkout

In an ideal world you would do a checkout from the head, make your changes, test them, and submit a cvs diff as above. If you are unwilling to do so, a diff based patch is still useful to the project but is less likely to be applied as quickly (if at all). Posting entire changed files is almost useless since it is difficult and time consuming to find what you have changed and such postings are entirely likely to be rejected outright.

if you have new files to add to your patch, add them to the patch file via: diff -u /dev/null new-file >> patch-file


Jeff Davis
Last modified: Fri Dec 13 06:39:02 EST 2002