How to do a diff

In part of a conversation about checkpoint work, Matt Dillon described the preferred process for code changes. I’m pasting it in, wholesale.

“Yah, the output of cvs diff makes an excellent patch. If you have cvs add’d new files use ‘cvs diff -N’ to ensure that the new files are included in the patch. Also, cvs diff from a high-enough level directory so the Index: lines are meaningful to the person doing the patching. e.g. ‘cd /usr/src/sys; cvs diff -N kern vm sys‘.

The defacto standard is also to use a unified diff, aka diff -u. This can be set in your ~/.cvsrc or specified on the command line. Most BSD developers seem to like unified diffs because they are far more readable once you get used to them.

# cat ~/.cvsrc
cvs -q -g
diff -u
update -Pd
checkout -P

You can give diff -N too but I usually like to specify that one manually.”