diff --git a/contrib/adc/set-head b/contrib/adc/set-head deleted file mode 100755 index e66f460..0000000 --- a/contrib/adc/set-head +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -. $(dirname $0)/adc.common-functions - -[ -z "$GL_RC" ] && die "ENV GL_RC not set" - -[ -z "$2" ] && die "usage: set-head /path/to/repo.git refs/heads/branchname" - -get_rights_and_owner $1; to=$repo -[ -z "$perm_write" ] && die "no write permissions on $to" - -# change head -cd $GL_REPO_BASE_ABS/$to.git - -git symbolic-ref HEAD $2 -echo HEAD on $to is `git symbolic-ref HEAD` -cd - > /dev/null diff --git a/contrib/adc/symbolic-ref b/contrib/adc/symbolic-ref new file mode 100755 index 0000000..86e5b8b --- /dev/null +++ b/contrib/adc/symbolic-ref @@ -0,0 +1,33 @@ +#!/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 " + +get_rights_and_owner $1; to=$repo +[ -z "$perm_write" ] && die "no write permissions on $to" +shift + +# change head +cd $GL_REPO_BASE_ABS/$to.git + +git symbolic-ref "$@"