summaryrefslogtreecommitdiff
path: root/lib/gitolite3/hooks/common/post-receive
blob: ab100d96966eab16ae3ec9a303dda4e90d30ff7e (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. WEB_BRANCH=${GL_OPTION_WEB_BRANCH:-}
  8. [ -n "$WEB_BRANCH" ] || exit 0
  9. # which git branch to check out
  10. WEB_BASEDIR=${GL_OPTION_WEB_BASEDIR:-/var/www/gitolite3}
  11. GIT_WORK_TREE="$WEB_BASEDIR/$GL_REPO"
  12. export GIT_WORK_TREE
  13. pwd
  14. echo "Checking out content to $GIT_WORK_TREE ..."
  15. git checkout -f "$WEB_BRANCH"
  16. chmod -R u=rw,go=r,a+X "$GIT_WORK_TREE"
  17. echo "Checkout completed succesfully!"