libreoffice-online/scripts/refresh-git-hooks
Gleb Popov 6622053557 scripts/refresh-git-hooks: Create hooks dir before making links.
Signed-off-by: Gleb Popov <6yearold@gmail.com>
Change-Id: I9ceb7894c0b670bf17cb89e0397b994b5e227ef7
2021-05-10 09:19:13 +02:00

25 lines
436 B
Bash
Executable file

#!/usr/bin/env bash
set -e
srcdir="$PWD"
if [ -n "${abs_srcdir}" ]; then
srcdir="${abs_srcdir}"
fi
if [ ! -d "${srcdir}/.git" ]; then
exit 0
fi
mkdir -p ${srcdir}/.git/hooks
for hook_name in ${srcdir}/.git-hooks/*
do
hook="${srcdir}/.git/hooks/${hook_name##*/}"
if [ ! -e "${hook}" ]; then
rm -f "${hook}"
ln -sf "${hook_name}" "${hook}"
fi
done
# vim:set shiftwidth=4 softtabstop=4 expandtab: