Commit 41a7fe5b authored by Brad King's avatar Brad King
Browse files

Add pre-commit hook to check whether SetupForDevelopment must re-run

Add a version number to the `` script and use
a pre-commit hook to check when it changes.
parent 71ba7b1a
.git* export-ignore
.gitattributes -export-ignore
.hooks* export-ignore
/GitSetup export-ignore
/ export-ignore eol=lf
[hooks "chain"]
pre-commit = GitSetup/pre-commit
#!/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
......@@ -10,3 +10,7 @@ GitSetup/tips
# 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}
Supports Markdown
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