#!/bin/sh # Gitolite helper script for manipulating with permission and description manipulation # Copyright 2011, 2014, 2017, Michal Sojka # License: GNU GPLv2+ curr_branch=$(git symbolic-ref -q HEAD) curr_branch_short=${curr_branch#refs/heads/} remote=$(git config --get "branch.$curr_branch_short.remote") url=$(git config --get "remote.$remote.url") || url=$remote url_sans_ssh=${url#ssh://} if [ x"$url_sans_ssh" != x"$url" ]; then userhost=${url_sans_ssh%%/*} repo=${url_sans_ssh#*/} else # scp-like syntax userhost=${url%%:*} repo=${url#*:} fi repo=${repo%.git} case "$(basename "$0")" in gl-perm|gl-perm-list) set -- perms "$repo" -l;; gl-perm-add-writer) set -- perms "$repo" + WRITERS "${1?Missing user name}";; gl-perm-add-reader) set -- perms "$repo" + READERS "${1?Missing user name}";; gl-perm-rm-writer) set -- perms "$repo" - WRITERS "${1?Missing user name}";; gl-perm-rm-reader) set -- perms "$repo" - READERS "${1?Missing user name}";; gl-desc-get) set -- desc "$repo";; gl-desc-set) set -- desc "$repo" "${1?No description given}";; esac (set -x; ssh "$userhost" "$@")