git.git: t/blob/pathinfo
[girocco/mytab.git] / update-hook
blob249cc01223a0009e537b596be5f101c66c0a1865
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
23 exit 0
26 # We are NOT inside the chroot
28 . @basedir@/shlib.sh
30 if [ "$cfg_permission_control" = "Hooks" ]; then
31 # We have some permission control to do!
32 proj="$(pwd)"; proj="${proj#$cfg_reporoot/}"; proj="${proj%.git}"
33 # XXX: Sanity check on project name and $USER here? Seems superfluous.
34 if ! perl -I@basedir@ -MGirocco::Project -le 'exit(1) unless Girocco::Project->load("'$proj'")->can_user_push("'$USER'")'; then
35 echo "The user '$USER' does not have push permissions for project '$proj'" >&2
36 echo "You can adjust push permissions at $cfg_webadmurl/editproj.cgi?name=$proj" >&2
37 exit 3
41 exit 0