af6820a94b
(can_* == can_read, can_write, and can_create) See top of contrib/adc/adc.common-functions for more on this. Note: the old style (calling get_rights_and_owner with $repo, then checking $perm_read, $perm_write, etc.), will still work fine.
36 lines
1.2 KiB
Bash
Executable file
36 lines
1.2 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
# allow 'git symbolic-ref' over a gitolite connection
|
|
|
|
# replaces and obsoletes the 'set-head' ADC, which was too specific
|
|
|
|
# Security: remember all arguments to ADCs must match a very conservative
|
|
# pattern; see doc/admin-defined-commands.mkd. Once that is assured, the
|
|
# symbolic-ref command has no security related side-effects, so we don't check
|
|
# arguments at all -- we just pass them on.
|
|
|
|
# Note: because of the restriction on allowed characters in arguments, you
|
|
# can't supply an arbitrary string to the '-m' option. The simplest
|
|
# work-around is-to-just-use-join-up-words-like-this if you feel the need to
|
|
# supply a "reason" string. In any case this is useless by default; you'd
|
|
# have to have core.logAllRefUpdates set for it to have any meaning.
|
|
|
|
. $(dirname $0)/adc.common-functions
|
|
|
|
[ -z "$GL_RC" ] && die "ENV GL_RC not set"
|
|
|
|
# notice we don't check for existence of arg 3, to allow the query semantics
|
|
# of git-symbolic-ref to also work
|
|
[ -z "$2" ] && die "usage: symbolic-ref /path/to/repo.git <arguments to git-symbolic-ref>"
|
|
|
|
# all the can_* functions set $repo
|
|
can_write $1 || die "no write permissions on $repo"
|
|
to=$repo
|
|
|
|
shift
|
|
|
|
# change head
|
|
cd $GL_REPO_BASE_ABS/$to.git
|
|
|
|
git symbolic-ref "$@"
|