aboutsummaryrefslogblamecommitdiffstats
path: root/git-init-shared
blob: ea18234be710b02b44af73ea70d6a5fa5dd00d66 (plain) (tree)
























                                                                 
#!/bin/sh

set -e

usage() {
	printf "usage: git init-shared directory [user...]\n" >&2
	exit 1
}

add_to_acl() {
	setfacl -m "d:u:$2:rwx" "$1"
	setfacl -m "u:$2:rwx" "$1"
}

test $# -ge 1 || usage
dir=$1
shift

mkdir "$dir"

for user in "$(id -un)" "$@"; do
	add_to_acl "$dir" "$user"
done

exec git init --bare "$dir"