diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-10-07 11:59:20 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@vmiklos.hu> | 2020-10-07 12:54:47 +0200 |
commit | 9619517a10e8ac3932179fccf4c2a4c96b21a217 (patch) | |
tree | c943545a49665011b19180a3ef1029bc69c585d5 /scripts | |
parent | Fix typos (diff) | |
download | online-9619517a10e8ac3932179fccf4c2a4c96b21a217.tar.gz online-9619517a10e8ac3932179fccf4c2a4c96b21a217.zip |
git hooks: enable them automatically during 'make'
So one can't forget enabling them.
Change-Id: Icb595e9d0711227eaa6f11c1a9ff87f2c361e0bb
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/refresh-git-hooks | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/refresh-git-hooks b/scripts/refresh-git-hooks new file mode 100755 index 0000000000..3a43bdd73f --- /dev/null +++ b/scripts/refresh-git-hooks @@ -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: |