jobs/gitwebcache.sh: Introduce for proactive cache regeneration; git.git: Add grpshar...
[girocco.git] / update-hook
blob41dc65c6d8529656c9698f6f97442ad92c2ef391
1 #!/bin/sh
3 # Currently, we just confine the mob user to the mob branch here.
5 # TODO: CIA support. Mailing list notifications support. Generalized
6 # branches push permissions support.
9 set -e
11 if ! [ -x /usr/bin/perl ]; then
12 # We are INSIDE the chroot
14 if [ -O /var/run/mob ]; then
15 if [ x"$1" != x"refs/heads/mob" ]; then
16 echo "The mob user can push only to the 'mob' branch, sorry" >&2
17 exit 1
19 if [ x"$2" = x"0000000000000000000000000000000000000000" ]; then
20 echo "The mob user cannot _create_ the 'mob' branch, sorry" >&2
21 exit 2
25 exit 0
28 # We are NOT inside the chroot
30 . @basedir@/shlib.sh
32 if [ "$cfg_permission_control" = "Hooks" ]; then
33 # We have some permission control to do!
34 proj="$(pwd)"; proj="${proj#$cfg_reporoot/}"; proj="${proj%.git}"
35 # XXX: Sanity check on project name and $USER here? Seems superfluous.
36 if ! perl -I@basedir@ -MGirocco::Project -le 'exit(1) unless Girocco::Project->load("'$proj'")->can_user_push("'$USER'")'; then
37 echo "The user '$USER' does not have push permissions for project '$proj'" >&2
38 echo "You can adjust push permissions at $cfg_webadmurl/editproj.cgi?name=$proj" >&2
39 exit 3
43 exit 0