Skip to content
Browse files

Improvements to my pre-commit hook template

  • Loading branch information...
1 parent d750c3e commit 6ba3184d7b9f6dae3d10379a6bac29a01ceef190 @jwiegley jwiegley committed Feb 21, 2009
Showing with 12 additions and 4 deletions.
  1. +12 −4 pre-commit.sh
View
16 pre-commit.sh
@@ -1,5 +1,9 @@
#!/bin/sh
+if [ ! $(git rev-parse --symbolic-full-name HEAD) = refs/heads/master ]; then
+ exit 0
+fi
+
# These are the locations I keep my temporary source and build trees in
TMPDIR=$HOME/Products/ledger-pre-commit
MIRROR=$HOME/Products/ledger-pre-commit-mirror
@@ -17,19 +21,23 @@ git diff-index --cached --name-only --diff-filter=D -z HEAD | \
# Copy only _changed files_ from MIRROR to TMPDIR, without copying timestamps.
# This includes copying over new files, and deleting removed ones. This way,
# "make check" will only rebuild what is necessary to validate the commit.
-rsync -rlpgoDO --size-only --delete \
- --exclude-from=tools/excludes $MIRROR/ $TMPDIR/
+rsync -rlpgoDOc --delete --exclude-from=tools/excludes $MIRROR/ $TMPDIR/
# Everything else happens in the temporary build tree
+if [ ! -f $TMPDIR/lib/utfcpp/source/utf8.h ]; then
+ rsync -a --delete lib/utfcpp/ $TMPDIR/lib/utfcpp/
+fi
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 the user doesn't have acprep or myacprep, look for
# other common autoconf-related script files.
if [ ! -f Makefile -o \
- \( -f tools/myacprep -a -f acprep -a \
- \( tools/myacprep -nt Makefile -o acprep -nt Makefile \) \) ]
+ Makefile.am -nt Makefile -o \
+ configure.ac -nt Makefile -o \
+ \( -f acprep -a acprep -nt Makefile \) -o \
+ \( -f tools/myacprep -a tools/myacprep -nt Makefile \) ]
then
if [ -f tools/myacprep ]; then
tools/myacprep --local

0 comments on commit 6ba3184

Please sign in to comment.
Something went wrong with that request. Please try again.