fixcvsdiff
Fix CVS diff output for patch application
SYNOPSIS
fixcvsdiff [-p] [-v] [-h] [diff-file ...]
PARAMETERS
-p
Prepend a patch(1) command line suitable for sh -c execution
-v
Enable verbose mode for debugging output processing
-h
Display usage help and exit
DESCRIPTION
The fixcvsdiff command processes output from cvs diff, converting it into a standard unified diff format compatible with patch(1). CVS diffs include module-relative paths, Index: lines, and === separators for multi-file diffs, which confuse standard patch tools.
fixcvsdiff strips these artifacts: it removes Index: headers, adjusts file paths to be relative to the current directory, eliminates === lines, and ensures proper --- and +++ headers. This makes the diff directly applicable via patch without manual editing.
Commonly used in CVS workflows for sharing changes, it reads from stdin or specified files and outputs cleaned diffs to stdout. With -p, it prepends a shell-ready patch command, enabling one-liner application like sh -c "$(fixcvsdiff)". Verbose mode aids debugging complex diffs.
Though effective for CVS, it's tied to that obsolete VCS; modern tools like Git have native clean diffs. Still useful for legacy CVS repositories or analyzing old patches.
CAVEATS
Intended for CVS only; unreliable with Git/SVN diffs or non-unified formats. CVS is deprecated—prefer modern VCS. Handles basic cases but may fail on renamed/deleted files or binary diffs.
EXAMPLE USAGE
cvs diff -u > changes.diff
fixcvsdiff changes.diff > clean.patch
patch -p0 < clean.patch
Or with -p: fixcvsdiff -p changes.diff | sh
INPUT PROCESSING
Expects cvs diff -u output. Strips:
- Index: module/path/file.c
- ===================================================================
- === file.c (revision 1.2)
Outputs standard --- a/file.c / +++ b/file.c headers.
HISTORY
Developed in late 1990s/early 2000s as part of CVS contrib directory (/usr/share/doc/cvs/contrib). Created by Larry Jones to streamline patch workflows amid CVS popularity. Persisted through CVS 1.x releases; faded with Git/Subversion rise post-2005.


