'g': actually set up git hooks properly

This commit is contained in:
Michael Stahl
2011-11-03 21:52:20 +01:00
parent 0ad9f4028d
commit a0eb50ac6c

24
g
View File

@@ -37,11 +37,11 @@ refresh_hooks()
core) core)
pushd $COREDIR > /dev/null pushd $COREDIR > /dev/null
for hook_name in $(ls -1 $COREDIR/git-hooks) ; do for hook_name in $(ls -1 $COREDIR/git-hooks) ; do
hook=".git/hooks/$hook_name" hook=".git/hooks/$hook_name"
if [ ! -x "$hook" -a ! -L "$hook" ] ; then if [ ! -x "$hook" ] ; then
rm -f "$hook" rm -f "$hook"
ln -s "git-hooks/$hook_name" "$hook" ln -sf "$COREDIR/git-hooks/$hook_name" "$hook"
fi fi
done done
popd > /dev/null popd > /dev/null
;; ;;
@@ -50,8 +50,10 @@ refresh_hooks()
pushd $COREDIR/clone/translations > /dev/null pushd $COREDIR/clone/translations > /dev/null
for hook_name in $(ls -1 $COREDIR/clone/translations/git-hooks) ; do for hook_name in $(ls -1 $COREDIR/clone/translations/git-hooks) ; do
hook=".git/hooks/$hook_name" hook=".git/hooks/$hook_name"
rm -f "$hook" if [ ! -x "$hook" ] ; then
ln -sf "git-hooks/$hook_name" "$hook" rm -f "$hook"
ln -sf "$COREDIR/clone/translations/git-hooks/$hook_name" "$hook"
fi
done done
# .gitattribute should be per-repo, avoid entangling repos # .gitattribute should be per-repo, avoid entangling repos
if [ -L .gitattributes ] ; then if [ -L .gitattributes ] ; then
@@ -60,7 +62,7 @@ refresh_hooks()
popd > /dev/null popd > /dev/null
fi fi
;; ;;
help|dictionaries) binfilter|help|dictionaries)
if [ -d $COREDIR/clone/$repo ] ; then if [ -d $COREDIR/clone/$repo ] ; then
pushd $COREDIR/clone/$repo > /dev/null pushd $COREDIR/clone/$repo > /dev/null
# fixme: we should really keep these per-repo to # fixme: we should really keep these per-repo to
@@ -68,8 +70,10 @@ refresh_hooks()
# are realy not independant yet, we keep using core's hooks # are realy not independant yet, we keep using core's hooks
for hook_name in $(ls -1 $COREDIR/git-hooks) ; do for hook_name in $(ls -1 $COREDIR/git-hooks) ; do
hook=".git/hooks/$hook_name" hook=".git/hooks/$hook_name"
rm -f "$hook" if [ ! -x "$hook" ] ; then
ln -sf "$COREDIR/git-hooks/$hook_name" "$hook" rm -f "$hook"
ln -sf "$COREDIR/git-hooks/$hook_name" "$hook"
fi
done done
# .gitattribute should be per-repo, avoid entangling repos # .gitattribute should be per-repo, avoid entangling repos
if [ -L .gitattributes ] ; then if [ -L .gitattributes ] ; then