From bcc7ede92b4a83a47cc6355c1c46fd31840d912c Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Thu, 5 Aug 2021 15:34:16 +0200 Subject: fix init logic of gitolite hook --- lib/gitolite3/hooks/common/post-receive | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lib/gitolite3/hooks/common') diff --git a/lib/gitolite3/hooks/common/post-receive b/lib/gitolite3/hooks/common/post-receive index 9c9aed7..4a869f3 100755 --- a/lib/gitolite3/hooks/common/post-receive +++ b/lib/gitolite3/hooks/common/post-receive @@ -24,15 +24,15 @@ export GIT_WORK_TREE pwd echo "Checking out content to $GIT_WORK_TREE ..." -init=1 -[ -e "$GIT_WORK_TREE" ] || init= - -git checkout -f "$WEB_BRANCH" - -chmod -R u=rw,go=r,a+X "$GIT_WORK_TREE" - -if [ -n "$WEB_EXEC_INIT" ] && [ -n "$init" ]; then - ( cd "$WEB_BASEDIR" && echo "$WEB_EXEC_INIT" | sh - ) +if [ -e "$GIT_WORK_TREE" ]; then + git checkout -f "$WEB_BRANCH" + chmod -R u=rw,go=r,a+X "$GIT_WORK_TREE" +else + git clone --quiet --branch "$WEB_BRANCH" + chmod -R u=rw,go=r,a+X "$GIT_WORK_TREE" + if [ -n "$WEB_EXEC_INIT" ]; then + ( cd "$WEB_BASEDIR" && echo "$WEB_EXEC_INIT" | sh - ) + fi fi if [ -n "$WEB_EXEC" ]; then -- cgit v1.2.3