General fedpkg git hook support [was: Re: really stop "really" commits (really!)]

T.C. Hollingsworth tchollingsworth at gmail.com
Sat Dec 14 19:27:20 UTC 2013


On Fri, Dec 13, 2013 at 8:35 PM, Rahul Sundaram <metherid at gmail.com> wrote:
> On Fri, Dec 13, 2013 at 8:42 PM, T.C. Hollingsworth wrote:
>> 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
>
> Would it be possible to hook it up with fedpkg by default so that all Fedora
> packagers get this functionality?

Sure.  `fedpkg clone` could easily be taught to install hooks.  Not
sure what to do about existing clones.  (I guess we could provide a
`fedpkg install-hooks` or just require a new clone if you want the new
magic.)

If fedpkg (actually I'd say pyrpkg, I suppose RHEL maintainers would
find this useful too ;-) were to have hook support, I'd much prefer to
add some general support for git hooks to it and include this one as a
default one, rather than just this one specifically.

So it would just symlink a simple script in each clone that executes
everything in some drop-in directory.  (/usr/lib/rpkg/hooks/pre-commit
or so?  If we do it in rpkg do we need a Fedora-specific dir too?
Maybe $XDG_CONFIG_DIR/rpkg/hooks/pre-commit also so packagers can add
their own stuff easily?)  This way rpkg/fedpkg can ship some common
obvious ones and there's an easy way for others to add additional ones
that aren't of interest to the entire packaging community.

Also, I wonder if there are use cases for other hooks.  Pre-commit is
definitely useful, but some of them ([prepare-]commit-msg, update
[which runs prior to a push]) could possibly be relevant.  Might be
overengineering, but I'd hate to go through all the work to enable
pre-commit hooks just for someone to come up with an awesome use-case
for another one three months later.

Anyway, I'd be happy to cook up a patch for this if it would be
something dgilmore is interested in merging.

-T.C.


More information about the devel mailing list