jobd: Queue GC operations even for projects that shouldn't run update
[girocco/testingthisout.git] / hooks / update
blob6eb9b22c697a8c022e3770b272cdcc1c337f2085
1 #!/bin/sh
3 # Currently, we just confine the mob user to the mob branch here.
5 # TODO: Generalized branches push permissions support.
7 set -e
9 if ! [ -x /usr/bin/perl ]; then
10 # We are INSIDE the chroot
12 if [ -O /var/run/mob ]; then
13 if [ x"$1" != x"refs/heads/mob" ]; then
14 echo "The mob user can push only to the 'mob' branch, sorry" >&2
15 exit 1
17 if [ x"$2" = x"0000000000000000000000000000000000000000" ]; then
18 echo "The mob user cannot _create_ the 'mob' branch, sorry" >&2
19 exit 2
21 if [ x"$3" = x"0000000000000000000000000000000000000000" ]; then
22 echo "The mob user cannot _delete_ the 'mob' branch, smch, sorry"
23 exit 3
27 exit 0
30 # We are NOT inside the chroot
32 . @basedir@/shlib.sh
34 if [ "$cfg_permission_control" = "Hooks" ]; then
35 # We have some permission control to do!
36 proj="$(pwd)"; proj="${proj#$cfg_reporoot/}"; proj="${proj%.git}"
37 # XXX: Sanity check on project name and $USER here? Seems superfluous.
38 if ! perl -I@basedir@ -MGirocco::Project -le 'exit(1) unless Girocco::Project->load("'$proj'")->can_user_push("'$USER'")'; then
39 echo "The user '$USER' does not have push permissions for project '$proj'" >&2
40 echo "You can adjust push permissions at $cfg_webadmurl/editproj.cgi?name=$proj" >&2
41 exit 3
45 exit 0