blob: 10a97d9e6c2d4eea276be521f1b9e93d960053d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#! /usr/bin/env bash
# Execute various pre-commit scripts in a git repository.
#
# To enable the hooks globally run:
#
# $ git config --global core.hooksPath <git-project-dir>/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
src_exe="$(realpath "${BASH_SOURCE[0]}")"
src_dir="$(dirname "$src_exe")"
# Run each hook checking the exit status and bailing out if unsuccessful. We
# can just exec the last one.
#
exec "$src_dir/pre-commit-copyright-check"
|