summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2021-08-05 16:26:32 +0200
committerJonas Smedegaard <dr@jones.dk>2021-08-05 16:27:42 +0200
commitf88f5a6faceaee1d7fb1e55fd49eed2e88f33728 (patch)
tree5e7a542e876c889e9d96f2b93e340a4219a683a1 /lib
parentab2d075658660d45ad1ebe0a286b0dc6b3d220b2 (diff)
fix path handling in gitolite hook
Diffstat (limited to 'lib')
-rwxr-xr-xlib/gitolite3/hooks/common/post-receive15
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/gitolite3/hooks/common/post-receive b/lib/gitolite3/hooks/common/post-receive
index 9731280..a5f9ab6 100755
--- a/lib/gitolite3/hooks/common/post-receive
+++ b/lib/gitolite3/hooks/common/post-receive
@@ -15,28 +15,25 @@ WEB_EXEC_INIT=${GL_OPTION_WEB_EXEC_INIT:-}
[ -n "$WEB_BRANCH" ] || exit 0
-# which git branch to check out
WEB_BASEDIR=${GL_OPTION_WEB_BASEDIR:-/var/www/gitolite3}
GIT_WORK_TREE="$WEB_BASEDIR/$GL_REPO"
-export GIT_WORK_TREE
-
-pwd
-echo "Checking out content to $GIT_WORK_TREE ..."
if [ -e "$GIT_WORK_TREE" ]; then
- git checkout -f "$WEB_BRANCH"
+ echo "Refreshing content in $GIT_WORK_TREE ..."
+ git -C "$GIT_WORK_TREE" checkout -f "$WEB_BRANCH"
chmod -R u=rw,go=r,a+X "$GIT_WORK_TREE"
else
- git clone --quiet --branch "$WEB_BRANCH" .
+ echo "Checking out content to $GIT_WORK_TREE ..."
+ git -C "$WEB_BASEDIR" clone --quiet --branch "$WEB_BRANCH" "$PWD"
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 - )
+ ( cd "$GIT_WORK_TREE" && echo "$WEB_EXEC_INIT" | sh - )
fi
fi
if [ -n "$WEB_EXEC" ]; then
- ( cd "$WEB_BASEDIR" && echo "$WEB_EXEC" | sh - )
+ ( cd "$GIT_WORK_TREE" && echo "$WEB_EXEC" | sh - )
fi
echo "Checkout completed succesfully!"