Commit 31dd722a authored by Brad King's avatar Brad King

Add VTK-specific local commit hooks

Add ".hooks-config.bash" to tell the main hooks to chain to our hooks.
Add a pre-commit hook that cooperates with to
ensure the user has run the most recent hook setup script.  Add a
prepare-commit-msg hook to mention the "WIP:" prefix in the standard
commented commit message instructions.

Change-Id: I034afb64aa4fbbcaafd70d8a57493495d8736181
parent 622c3d58
.git* export-ignore
.hooks* export-ignore
*.sh crlf=input
newalpha crlf=input
# Loaded by .git/hooks/(pre-commit|commit-msg|prepare-commit-msg)
# during git commit after local hooks have been installed.
#!/usr/bin/env bash
egrep-q() {
egrep "$@" >/dev/null 2>/dev/null
die() {
echo 'pre-commit hook failure' 1>&2
echo '-----------------------' 1>&2
echo '' 1>&2
echo "$@" 1>&2
exit 1
# Check that developmer setup is up-to-date.
lastSetupForDevelopment=$(git config --get hooks.SetupForDevelopment || echo 0)
eval $(grep '^SetupForDevelopment_VERSION=' "${BASH_SOURCE%/*}/../")
test -n "$SetupForDevelopment_VERSION" || SetupForDevelopment_VERSION=0
if test $lastSetupForDevelopment -lt $SetupForDevelopment_VERSION; then
die 'Developer setup in this work tree is out of date. Please re-run
#!/usr/bin/env bash
egrep-q() {
egrep "$@" >/dev/null 2>/dev/null
# First argument is file containing commit message.
# Check for our extra instructions.
egrep-q "^# Start the commit message" -- "$commit_msg" && return 0
# Insert our extra instructions.
sed 's/^# \(On\|Not currently on any\) branch.*/'\
'# Start the commit message in "WIP: " to indicate Work In Progress\
# that is not yet ready to merge.\
&/' "$commit_msg" > "$commit_msg_tmp" &&
mv "$commit_msg_tmp" "$commit_msg"
......@@ -11,3 +11,7 @@ Utilities/Scripts/
# Rebase master by default
git config rebase.stat true
git config branch.master.rebase true
# Record the version of this setup so Scripts/pre-commit can check it.
git config hooks.SetupForDevelopment ${SetupForDevelopment_VERSION}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment