summaryrefslogtreecommitdiffstats
path: root/vendor/gix/src/assets/init/hooks/pre-applypatch.sample
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gix/src/assets/init/hooks/pre-applypatch.sample')
-rwxr-xr-xvendor/gix/src/assets/init/hooks/pre-applypatch.sample27
1 files changed, 27 insertions, 0 deletions
diff --git a/vendor/gix/src/assets/init/hooks/pre-applypatch.sample b/vendor/gix/src/assets/init/hooks/pre-applypatch.sample
new file mode 100755
index 000000000..de06c7f7f
--- /dev/null
+++ b/vendor/gix/src/assets/init/hooks/pre-applypatch.sample
@@ -0,0 +1,27 @@
+#!/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.
+: