-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathprepare-commit-msg
More file actions
20 lines (17 loc) · 848 Bytes
/
prepare-commit-msg
File metadata and controls
20 lines (17 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh
# Fail on error and unset variables
set -eu
# Determine project root as the parent directory of this hook script
PROJECT_ROOT="$(CDPATH= cd -- "$(dirname -- "$0")"/.. && pwd)"
# Run the Ruby hook within the direnv context (if available),
# so ENV from .envrc/.env.local at project root is loaded.
# One of the things .envrc needs to do is add $PROJECT_ROOT/bin/ to the path.
# You should have this line at the top of .envrc
# PATH_add bin
# NOTE: this project needs to also add exe as well,
# but other libraries won't generally need to do that.
if command -v direnv >/dev/null 2>&1; then
exec direnv exec "$PROJECT_ROOT" "kettle-commit-msg" "$@"
else
raise "direnv not found. Local development of this project ($PROJECT_ROOT) with tools from the kettle-dev gem may not work properly. Please run 'brew install direnv'."
fi