Use working_directory in clone_customer_repository

This commit is contained in:
Gerhard Hoffmann 2022-06-03 21:20:18 +02:00
parent 838b932cac
commit a507e9c29c

View File

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