From b0d641ef48c38e1a6afe84c652c68a7271b0f796 Mon Sep 17 00:00:00 2001 From: Teemu Matilainen Date: Thu, 18 Nov 2010 20:18:07 +0200 Subject: [PATCH] gl-setup: Avoid stupid "cd -" simulation tricks They don't work if someone calls the script for example su - gitolite -c gl-setup 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 ;-)] --- src/gl-setup | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/gl-setup b/src/gl-setup index 9f36355..8ff06b1 100755 --- a/src/gl-setup +++ b/src/gl-setup @@ -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