3 # Gitolite helper script for manipulating with permission and description manipulation
4 # Copyright 2011, 2014, 2017, 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 [ x"$url_sans_ssh" != x"$url" ]; then
14 userhost=${url_sans_ssh%%/*}
15 repo=${url_sans_ssh#*/}
23 case "$(basename "$0")" in
25 set -- perms "$repo" -l;;
27 set -- perms "$repo" + WRITERS "${1?Missing user name}";;
29 set -- perms "$repo" + READERS "${1?Missing user name}";;
31 set -- perms "$repo" - WRITERS "${1?Missing user name}";;
33 set -- perms "$repo" - READERS "${1?Missing user name}";;
37 set -- desc "$repo" "${1?No description given}";;
40 (set -x; ssh "$userhost" "$@")