Internal repo consistency checks

This commit is contained in:
Tony Garnock-Jones 2024-06-08 10:34:19 +02:00
parent 3d56309766
commit 0e81be663f
3 changed files with 43 additions and 0 deletions

View File

@ -1,3 +1,5 @@
__ignored__ := $(shell ./setup.sh)
# Use cargo release to manage publication and versions etc.
#
# cargo install cargo-release

23
git-hooks/pre-commit Executable file
View File

@ -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" ]

18
setup.sh Executable file
View File

@ -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