I am trying to enforce a policy where each push gets rejected when even one of the commit messages does not satisfy a rule. I've distributed a hook to the devs in order for them to use it in their local repos but I also want to enforce this when they push to the origin.
I have two questions:
Should I use the update hook or the pre-receive hook? (I've tried to setup an update.secondary hook but it seems to me it doesn't get fired, while a pre-receive does).
How can I get the message for each commit contained in the push? More specifically, I want each commit message to have a specific "valid" (for my needs) prefix. So I would like to scan for every commit in this push the commit message and validate it before I accept the push.
I am using simple bash to code the hooks.
Thanks!