summaryrefslogtreecommitdiff
path: root/lib/gitolite3/hooks/common/post-receive
blob: 934207579b1ddeba4f0c329862372271963c2852 (plain)
  1. #!/bin/sh
  2. # This gitolite3 hook exports content for web publishing.
  3. # The following gitolite3 environment variables affect its use:
  4. # WEB_BRANCH tree-ish (hook silently skipped if unset)
  5. # WEB_BASEDIR path writable by gitolite3 (default: /var/www/gitolite3)
  6. set -eu
  7. [ -n "$GL_OPTION_WEB_BRANCH" ] || exit 0
  8. # which git branch to check out
  9. WEB_BASEDIR=${GL_OPTION_WEB_BASEDIR:-/var/www/gitolite3}
  10. GIT_WORK_TREE="$WEB_BASEDIR/$GL_REPO"
  11. export GIT_WORK_TREE
  12. pwd
  13. echo "Checking out content to $GIT_WORK_TREE ..."
  14. git checkout -f "$GL_OPTION_WEB_BRANCH"
  15. chmod -R u=rw,go=r,a+X "$GIT_WORK_TREE"
  16. echo "Checkout completed succesfully!"