3 # Gitolite permission manipulation helper script
4 # Copyright 2011, Michal Sojka <wsh@2x.cz>
7 curr_branch=$(git symbolic-ref -q HEAD)
8 curr_branch_short="${curr_branch#refs/heads/}"
9 remote=$(git config --get branch.$curr_branch_short.remote)
10 url=$(git config --get remote.$remote.url) || url=$remote
12 url_sans_ssh=${url#ssh://}
13 if test x$url_sans_ssh != x$url; then
14 userhost=${url_sans_ssh%%/*}
15 repo=${url_sans_ssh#*/}
23 if test x$bn = xgl-perm; then
31 ssh $userhost getperms $repo;;
33 ssh $userhost setperms $repo;;
35 perms=$(ssh $userhost getperms $repo)
36 ( test "$perms" && echo "$perms"; echo $* ) | ssh $userhost setperms $repo;;
39 perms=$(ssh $userhost getperms $repo) # setperms does not work when executed in the same pipe with getperms
40 echo "$perms" | sed -e "s/[[:space:]]*\\b$user\\b//g" -e "/^[[:alnum:]]\+[[:space:]]*$/d" | ssh $userhost setperms $repo;;