summaryrefslogtreecommitdiff
path: root/lib/gitolite3
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2021-08-05 15:34:16 +0200
committerJonas Smedegaard <dr@jones.dk>2021-08-05 15:34:16 +0200
commitbcc7ede92b4a83a47cc6355c1c46fd31840d912c (patch)
tree6c9e25ce50a113924da1aad10170c7ec2ff408b2 /lib/gitolite3
parent1aa84a363e202db018139b10b4eac01950d231ab (diff)
fix init logic of gitolite hook
Diffstat (limited to 'lib/gitolite3')
-rwxr-xr-xlib/gitolite3/hooks/common/post-receive18
1 files changed, 9 insertions, 9 deletions
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