diff options
Diffstat (limited to 'bdep-util/git-hooks')
-rw-r--r-- | bdep-util/git-hooks/.gitignore | 1 | ||||
-rw-r--r-- | bdep-util/git-hooks/pre-commit.in | 23 |
2 files changed, 24 insertions, 0 deletions
diff --git a/bdep-util/git-hooks/.gitignore b/bdep-util/git-hooks/.gitignore new file mode 100644 index 0000000..416634f --- /dev/null +++ b/bdep-util/git-hooks/.gitignore @@ -0,0 +1 @@ +pre-commit diff --git a/bdep-util/git-hooks/pre-commit.in b/bdep-util/git-hooks/pre-commit.in new file mode 100644 index 0000000..3339187 --- /dev/null +++ b/bdep-util/git-hooks/pre-commit.in @@ -0,0 +1,23 @@ +#! /usr/bin/env bash + +# file : bdep-util/git-hooks/pre-commit.in +# license : MIT; see accompanying LICENSE file + +# Forward the execution to the pre-commit script implementation. +# +# To enable the hooks globally run, for example: +# +# $ git config --global core.hooksPath /usr/local/bin/bdep-git-hooks +# +# Notes: +# +# - git passes no parameters to this kind of hooks. +# +# - git changes CWD to the git repository root directory for the hook process. +# +# - git command running from inside the hook sees files that should be +# auto-staged due to the -a git-commit option or similar as already staged. +# +trap 'exit 1' ERR + +source "$(dirname "$(realpath "${BASH_SOURCE[0]}")")/../bdep-git-pre-commit" |