I need to check the commit messages that are pushed to the remote server so that the developers do not post enough details (line length) or only the ticket number.
I thought that the update hook would work for this, but it doesnβt seem to, but it only works for the link that was clicked earlier. When I tried to push a new branch, it rejected because I could not find the link. I suspect that it can only work against the last commit in the pressed series as well.
What will be the right choice for this task?
Excerpt:
#!/usr/bin/env php <?php define('MINIMUM_MESSAGE_LENGTH', 10); $exit = 0; // default exit code -> success $ref = $argv[1]; $commitMessage = exec('git log -1 ' . $ref . ' --pretty=format:%s'); $commitMessage = trim($commitMessage); // validations & exit($exit) follow;
yep is PHP but the question is agnostic language
source share