gl-setup: Avoid stupid "cd -" simulation tricks

They don't work if someone calls the script for example
    su - gitolite -c gl-setup <key>
from a directory where "gitolite" user does not have permissions (e.g.
0700), then 'cd $od' fails and we stay in gitolite's $HOME.

[commit message changed by committer; author was more polite ;-)]
This commit is contained in:
Teemu Matilainen 2010-11-18 20:18:07 +02:00 committed by Sitaram Chamarty
parent d8179f09bf
commit b0d641ef48

View file

@ -99,11 +99,12 @@ touch $HOME/.ssh/authorized_keys
gl-compile-conf -q
# setup push-to-admin
od=$PWD
cd; cd $REPO_BASE/gitolite-admin.git
GIT_WORK_TREE=$GL_ADMINDIR git add conf/gitolite.conf keydir
GIT_WORK_TREE=$GL_ADMINDIR git diff --cached --quiet 2>/dev/null || GIT_WORK_TREE=$GL_ADMINDIR git commit -am start
cd $od
(
cd $HOME; cd $REPO_BASE/gitolite-admin.git
GIT_WORK_TREE=$GL_ADMINDIR; export GIT_WORK_TREE
git add conf/gitolite.conf keydir
git diff --cached --quiet 2>/dev/null || git commit -am start
)
# now that the admin repo is created, you have to set the hooks properly; best
# do it by running install again