After clone: fetch the reposiry again, follwed by a git reset --hard.

The effect is that git crates all diretories and files in /etc and /opt.
This commit is contained in:
Gerhard Hoffmann 2023-03-30 13:59:38 +02:00
parent 52271bef21
commit 8b5cda7f73

View File

@ -89,18 +89,30 @@ clone_customer_repository () {
if cd ${CUSTOMER_ID_BASE_DIR}; then
# local res=$(exec_git_command git --git-dir=.git --work-tree=/ init)
exec_git_command git checkout "$LOCAL_BRANCH"
exec_git_command git config core.worktree "/"
if [[ $? -eq 0 ]]; then
# re-initialized. copy post-merge (a hook called
# when 'git pull' is executed and changed data
# are received).
if cp ".githooks/post-merge" ".git/hooks"; then
log_debug "$func:${LINENO} copied post-merge to .git/hooks"
CLONE_CUSTOMER_REPOSITORY=true
log_debug "$func:${LINENO} re-init of ${1} done"
cd_home; return 0
log_debug "$func:${LINENO} checked out local branch $LOCAL_BRANCH"
exec_git_command git config core.worktree "/"
if [[ $? -eq 0 ]]; then
log_debug "$func:${LINENO} configured worktree"
exec_git_command git fetch --all
if [[ $? -eq 0 ]]; then
log_debug "$func:${LINENO} fetch repository"
exec_git_command git reset --hard "$LOCAL_BRANCH"
if [[ $? -eq 0 ]]; then
log_debug "$func:${LINENO} reset --hard $LOCAL_BRANCH"
# re-initialized. copy post-merge (a hook called
# when 'git pull' is executed and changed data
# are received).
if cp ".githooks/post-merge" ".git/hooks"; then
log_debug "$func:${LINENO} copied post-merge to .git/hooks"
CLONE_CUSTOMER_REPOSITORY=true
log_debug "$func:${LINENO} re-init of ${1} done"
cd_home; return 0
fi
fi
fi
fi
fi
fi
fi
fi
cd_home; return 1