summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2021-04-20 22:14:14 +0200
committerJonas Smedegaard <dr@jones.dk>2021-04-20 22:14:14 +0200
commit4f728070b7e7be3301bc66dc24894df12f4f9b14 (patch)
tree66d60249bc81a60fc53c7642fd5ee85c92d3daf3 /lib
parent95862f2b20c81294413824ec2dd00f9b17905994 (diff)
preliminary gitolite3 documentation
Diffstat (limited to 'lib')
-rwxr-xr-xlib/gitolite3/hooks/common/post-receive25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/gitolite3/hooks/common/post-receive b/lib/gitolite3/hooks/common/post-receive
new file mode 100755
index 0000000..9342075
--- /dev/null
+++ b/lib/gitolite3/hooks/common/post-receive
@@ -0,0 +1,25 @@
+#!/bin/sh
+# This gitolite3 hook exports content for web publishing.
+
+# The following gitolite3 environment variables affect its use:
+# WEB_BRANCH tree-ish (hook silently skipped if unset)
+# WEB_BASEDIR path writable by gitolite3 (default: /var/www/gitolite3)
+
+set -eu
+
+[ -n "$GL_OPTION_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 ..."
+
+git checkout -f "$GL_OPTION_WEB_BRANCH"
+
+chmod -R u=rw,go=r,a+X "$GIT_WORK_TREE"
+
+echo "Checkout completed succesfully!"