Atlassian Marketplace currently has 4 different free add-ons for Bitbucket to help admins enforce a JIRA policy with commit messages. This inspired me to write a 5th one. A paid one.
What it does
It blocks foxtrot merges, enforces authorship policy, and forces developers to reference JIRA tickets in all their commit messages.
Unlike other JIRA hooks, this one operates globally (instantly active for all repositories). It also leverages the Branching Model for choosing which branches to enforce the policy against, whereas the competition uses regexp.
We do pre-receive and merge, and, unlike the others, we don't block merges between long-running branches when non-compliant commits have been grandfathered. This turns out to be important: when release/1.2.3 branch received a commit with message "BUG-38 - Important Fix", the JIRA ticket BUG-38 was still open. Later we realized we needed to also merge this into release/2.3.4, but BUG-38 had since been closed. The competing solutions will block this merge, since BUG-38 is closed, but our hook notices the original commit was processed properly, and let's the merge through.
Accomplishments that I'm proud of
Here's my secret sauce for the pre-receive hook:
git log <commit_1> <commit_2> <commit_3> <etc...> --not --all
Leave a comment if you can guess the point of the "--not --all"!
What's next for Bit-Booster - Global JIRA Foxtrot Hook
Per-project and per-repo overrides.