git hooks: enable them automatically during 'make'

So one can't forget enabling them.

Change-Id: Icb595e9d0711227eaa6f11c1a9ff87f2c361e0bb
pull/196/head
Miklos Vajna 2020-10-07 11:59:20 +02:00 committed by Miklos Vajna
parent 9d01540680
commit 9619517a10
3 changed files with 25 additions and 0 deletions

View File

@ -322,6 +322,7 @@ EXTRA_DIST = discovery.xml \
etc/apache2/loolwsd.conf \
etc/nginx/loolwsd.conf \
scripts/unocommands.py \
scripts/refresh-git-hooks \
$(man_MANS)
if ENABLE_LIBFUZZER
@ -501,6 +502,7 @@ endif
# installing the RPM or Debian package.
all-local: $(ALL_LOCAL_DEPS) @JAILS_PATH@ $(SYSTEM_STAMP)
$(SET_CAPS_COMMAND)
@$(abs_top_srcdir)/scripts/refresh-git-hooks
# just run the build without any tests
build-nocheck: all-am

View File

@ -30,6 +30,8 @@ automake --add-missing || failed "automake"
autoreconf || failed "autoreconf"
scripts/refresh-git-hooks || failed "refresh-git-hooks"
cat << EOF
Result: All went OK, please run $srcdir/configure (with the appropriate parameters) now.

View File

@ -0,0 +1,21 @@
#!/bin/bash -e
srcdir="$PWD"
if [ -n "${abs_srcdir}" ]; then
srcdir="${abs_srcdir}"
fi
if [ ! -d "${srcdir}/.git" ]; then
exit 0
fi
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: