Start shipping hooks, pre-commit with readmeta first

This commit is contained in:
Daniel Martí 2014-05-27 13:52:22 +02:00
parent 594733d0e6
commit 24b1ba0e8a
2 changed files with 39 additions and 0 deletions

29
hooks/install-hooks.sh Executable file
View file

@ -0,0 +1,29 @@
#!/bin/sh
#
# Install all the client hooks
BASE_DIR=$(dirname $0)
HOOK_NAMES="applypatch-msg pre-applypatch post-applypatch pre-commit prepare-commit-msg commit-msg post-commit pre-rebase post-checkout post-merge pre-receive update post-receive post-update pre-auto-gc"
HOOK_DIR=$(git rev-parse --show-toplevel)/.git/hooks
for hook in $HOOK_NAMES; do
shipped_hook=$BASE_DIR/$hook
installed_hook=$HOOK_DIR/$hook
# If we don't distribute it, continue
if [ ! -f $shipped_hook ]; then
continue
fi
# If the hook already exists, continue
if [ -e $installed_hook -o -h $installed_hook ]; then
echo "$installed_hook hook already exists."
continue
fi
# Create the symlink
echo "ln -s $shipped_hook $installed_hook"
ln -s $shipped_hook $installed_hook
done

10
hooks/pre-commit Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
#
# Simple pre-commit hook to check that there are no errors in the fdroid
# metadata files.
# Redirect output to stderr.
exec 1>&2
# If there are metadata errors, print the stack traces and fail.
exec fdroid readmeta