Git hooks

Tobia Conforto tobia.conforto at gruppo4.eu
Fri Apr 15 17:14:12 UTC 2016


Hello

I would like to add a hook to my Git repositories on Kallithea, in order to refuse commits that have certain characteristics. Right now I can check for the mistakes I want to forbid with a bash one-liner, although I can rewrite it in Python if I have need to:

	wc public/css/*.css public/js/*.js | awk '$3/$1<100 {exit(1)}'

This is a heuristic that exits with 1 if there are any CSS or JS files in the given location that have not been properly minified.

How can I add this check to my remote repositories, so that they refuse commits with this mistake?

Should I add Git hooks to the actual repositories on the Kallithea server? If so, what should I do with the hooks/pre-receive file that is already there? Otherwise, where can I add this check?

Tobia


More information about the kallithea-general mailing list