Invariably when adding a patch to a spec, often I forget some detail,
whether it be adding the %patchN macro to %prep or `git add`ing the
patch. It would seem I'm not alone, either. A Google search for e.g.
"site:https://lists.fedoraproject.org/pipermail/scm-commits/ really
apply patch" returns tens of thousands of results! ;-)
To prevent this from happening in the future, I wrote a little git
pre-commit hook to help out, which I figured I'd share with you all:
http://patches.fedorapeople.org/patchcheck.py
It verifies that:
- all patches are committed to git
- all patches are applied in %prep
- no unexpanded %patch macros exist in %prep
If any of the above checks fail, the commit is aborted.
To use it, download it somewhere, make it executable, and symlink
$clone/.git/hooks/pre-commit to it. If you already have a pre-commit
hook of some sort, you can instead just run that script in it and
abort on a non-zero exit code.
Hopefully some of you find it useful.
-T.C.