fix usage of branches with auto-ansible

This commit is contained in:
onalyrg 2025-06-08 16:40:31 +02:00
parent 7a30d8f493
commit a2b2dcd449
No known key found for this signature in database
GPG key ID: C5D2708CDF29B4D1

View file

@ -111,6 +111,7 @@ PASSWORD_STORE_DIR="${AUTOANSIBLE_PASS_DIR}"
git_reset_pull () {
repo_dir="$1"
branch="$2"
printf "%s\n" "* cd ${repo_dir}" >> ${LOGFILE2}
cd "${repo_dir}"
@ -177,6 +178,9 @@ git_reset_pull () {
# keep branch list up-to-date
printf "%s\n" "* $BIN_GIT fetch -q --all --prune --recurse-submodules" >> ${LOGFILE2}
$BIN_GIT fetch -q --all --prune --recurse-submodules >> ${LOGFILE2}
# Switch to desired branch
printf "%s\n" "* $BIN_GIT checkout -q ${branch}" >> ${LOGFILE2}
$BIN_GIT checkout -q "${branch}" >> ${LOGFILE2}
return $ret
}
@ -188,7 +192,7 @@ git_clone_pull () {
# operations on the repo
if [ -d "${repo_dir}" ]; then
git_reset_pull "${repo_dir}" >> ${LOGFILE2}
git_reset_pull "${repo_dir}" "${branch}" >> ${LOGFILE2}
ret=$?
elif [ -e "${repo_dir}" ]; then
printf "%s\n" "ERROR: Destination ${repo_dir} already exists and is not a dir. Exiting." 1>&2