diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-13 05:33:55 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-13 05:33:55 -0400 |
commit | 10ba30ddfd8f4b9ee31826c0d0caa33056576bd5 (patch) | |
tree | 409bf78c3b6c6bb5e562cdb785fad7e0d687c726 /tools/pre-commit | |
parent | 70344b82e70f454462f31daec05d79554804e8f8 (diff) | |
download | fork-ledger-10ba30ddfd8f4b9ee31826c0d0caa33056576bd5.tar.gz fork-ledger-10ba30ddfd8f4b9ee31826c0d0caa33056576bd5.tar.bz2 fork-ledger-10ba30ddfd8f4b9ee31826c0d0caa33056576bd5.zip |
Added tools/excludes and tools/pre-commit
These files are used to creat ea Git pre-commit hook which verifies each
proposed change by running "make check". Otherwise, I only know if my
working tree is sane, and not if each commit is sane before it goes into
the repository.
Diffstat (limited to 'tools/pre-commit')
-rwxr-xr-x | tools/pre-commit | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tools/pre-commit b/tools/pre-commit new file mode 100755 index 00000000..32fc7b9e --- /dev/null +++ b/tools/pre-commit @@ -0,0 +1,39 @@ +#!/bin/sh + +set -e + +TMPDIR=$HOME/Products/ledger-pre-commit +MIRROR=$HOME/Products/ledger-pre-commit-mirror + +# Checkout a copy of the current index into TMPDIR +git checkout-index --prefix=$MIRROR/ -af + +# Remove files which are no longer present in the index +git diff-index --cached --name-only --diff-filter=D -z HEAD | \ + (cd $MIRROR && xargs -0 rm -f --) + +# Copy over changes, ignoring timestamps +rsync -rlpgoDO --size-only --delete \ + --exclude-from=tools/excludes $MIRROR/ $TMPDIR/ + +cd $TMPDIR + +# Make sure there is a current Makefile. Regeneration of Makefile happens +# automatically, but if myacprep or acprep changes, we want to regenerate +# everything manually. +if [ ! -f Makefile -o \ + \( -f tools/myacprep -a -f acprep -a \ + \( tools/myacprep -nt Makefile -o acprep -nt Makefile \) \) ] +then + if [ -f tools/myacprep ]; then + tools/myacprep --local + elif [ -f acprep ]; then + ./acprep --local + elif [ -f autogen.sh ]; then + sh autogen.sh && ./configure + else + autoreconf && ./configure + fi +fi + +nice -n 20 make check |