diff --git a/Makefile b/Makefile index ff8b200..27360b6 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +__ignored__ := $(shell ./setup.sh) + # Use cargo release to manage publication and versions etc. # # cargo install cargo-release diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit new file mode 100755 index 0000000..ee3cd6a --- /dev/null +++ b/git-hooks/pre-commit @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e +exec 1>&2 + +failed= +cmp_and_fail() { + if ! cmp "$1" "$2" + then + failed=failed + fi +} + +COMMAND=cmp_and_fail +if [ "$1" = "--fix" ]; +then + COMMAND=cp +fi + +# Ensure that various copies of cross-package data are identical. +${COMMAND} syndicate/protocols/schema-bundle.bin syndicate-schema-plugin/schema-bundle.bin + +[ -z "$failed" ] diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..67c08b0 --- /dev/null +++ b/setup.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# +# Set up a git checkout of this repository for local dev use. + +exec 2>/dev/tty 1>&2 + +set -e + +[ -d .git ] || exit 0 + +for fullhook in ./git-hooks/* +do + hook=$(basename "$fullhook") + [ -L .git/hooks/$hook ] || ( + echo "Installing $hook hook" + ln -s ../../git-hooks/$hook .git/hooks/$hook + ) +done