From 30d6370719263da531d2405fb561d34e1340f49e Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 31 Dec 2012 17:46:40 +0200 Subject: [PATCH] Add subdir support for rewrite-hooks script --- lib/support/rewrite-hooks.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/support/rewrite-hooks.sh b/lib/support/rewrite-hooks.sh index 6688785a1..b8fd36b9a 100755 --- a/lib/support/rewrite-hooks.sh +++ b/lib/support/rewrite-hooks.sh @@ -11,9 +11,22 @@ do continue fi - project_hook="$src/$dir/hooks/post-receive" - gitolite_hook="/home/git/.gitolite/hooks/common/post-receive" + if [[ "$dir" =~ ^.*.git$ ]] + then + project_hook="$src/$dir/hooks/post-receive" + gitolite_hook="/home/git/.gitolite/hooks/common/post-receive" + + ln -s -f $gitolite_hook $project_hook + else + for subdir in `ls "$src/$dir/"` + do + if [ -d "$src/$dir/$subdir" ] && [[ "$subdir" =~ ^.*.git$ ]]; then + project_hook="$src/$dir/$subdir/hooks/post-receive" + gitolite_hook="/home/git/.gitolite/hooks/common/post-receive" - ln -s -f $gitolite_hook $project_hook + ln -s -f $gitolite_hook $project_hook + fi + done + fi fi done -- 2.11.0