31 lines
718 B
Bash
Executable file
31 lines
718 B
Bash
Executable file
#!/bin/bash
|
|
|
|
export GL_BYPASS_UPDATE_HOOK
|
|
GL_BYPASS_UPDATE_HOOK=1
|
|
|
|
get_rc_val() {
|
|
${0%/*}/gl-query-rc $1
|
|
}
|
|
|
|
REPO_BASE=$( get_rc_val REPO_BASE)
|
|
REPO_UMASK=$(get_rc_val REPO_UMASK)
|
|
|
|
umask $REPO_UMASK
|
|
|
|
if echo $SSH_ORIGINAL_COMMAND | egrep git-upload\|git-receive >/dev/null
|
|
then
|
|
|
|
# the (special) admin post-update hook needs these, so we cheat
|
|
export GL_RC
|
|
export GL_ADMINDIR
|
|
export GL_BINDIR
|
|
GL_RC=$( get_rc_val GL_RC)
|
|
GL_ADMINDIR=$(get_rc_val GL_ADMINDIR)
|
|
GL_BINDIR=$( get_rc_val GL_BINDIR)
|
|
|
|
SSH_ORIGINAL_COMMAND=`echo $SSH_ORIGINAL_COMMAND | sed -e "s:':'$REPO_BASE/:"`
|
|
exec git shell -c "$SSH_ORIGINAL_COMMAND"
|
|
else
|
|
bash -c "cd $REPO_BASE; $SSH_ORIGINAL_COMMAND"
|
|
fi
|