#!/bin/sh # A sample hook to check commit messages created by `git am` ########################################################### # This hook script is triggered by `git am` without any context just before creating a commit, # which is useful to inspect the current tree or run scripts for further verification. # # If it exits with a non-zero exit code, the commit will not be created. Everything printed # to the output or error channels will be visible to the user. # # Note that there is a sibling hook called `post-applypatch` (also without further context) # which is run after the commit was created. It is useful to use the commit hash for further # processing, like sending information to the involved parties. # Finally, the `applypatch-msg` hook is called at the very beginning of the `git am` operation # to provide access to the commit-message. # # To enable this hook remove the `.sample` suffix from this file entirely. # Retrieve the path to the pre-commit hook script using the "git rev-parse" command. precommit="$(git rev-parse --git-path hooks/pre-commit)" # Check if the pre-commit hook script exists and is executable. # If it does, execute it passing the arguments from this script (if any) using the "exec" command. test -x "$precommit" && exec "$precommit" ${1+"$@"} # Be sure to exit without error if `exec` isn't called. :