diff --git a/git_helpers b/git_helpers index 9ccbf25..bfa0302 100755 --- a/git_helpers +++ b/git_helpers @@ -76,17 +76,15 @@ revert_to_commit_before_pull () { # this is done only once. clone_customer_repository () { local func="${FUNCNAME[0]}" - current_dir=${PWD##*/} - current_dir="./${current_dir:-/}" - if [ "$current_dir" = "./UpdateController" ]; then - if ! [[ -d ./workspace ]]; then - { mkdir -p ./workspace; } + if [ "$PWD" = "$working_directory" ]; then + if ! [[ -d $workspace_dir ]]; then + { mkdir -p ./$workspace_dir; } fi # check if the directory is empty. If so, clone the # customer repository - if ! find ./workspace -mindepth 1 -maxdepth 1 | read; then + if ! find ./$workspace_dir -mindepth 1 -maxdepth 1 | read; then log_debug "$func:${LINENO} cloning ${1} ..." - if { cd ./workspace ; }; then + if { cd ./$workspace_dir ; }; then $(exec_git_command git clone "$1") if [ $? -eq 0 ]; then log_debug "$func:${LINENO} cloning ${1} done" @@ -97,10 +95,12 @@ clone_customer_repository () { else # the directory is not empty, so we assume the customer-repository # has been cloned alread - if ! [[ -d ./workspace/$customer_id ]]; then - local m="wrong repository: $(ls -d './workspace/*')" + if ! [[ -d ./${workspace_dir}/$customer_id ]]; then + local m="wrong repository: $(ls -d './${workspace_dir}/*')" log_fatal "$func:${LINENO} $m" else + log_debug \ + "$func:${LINENO} ./${workspace_dir}/$customer_id exists" return 0 fi fi