From 56930c52bfd5a4c06adc6f22e446db8274346671 Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.dos.anjos@gmail.com> Date: Fri, 22 Sep 2017 11:30:21 +0200 Subject: [PATCH] Delete dav folder before recursive upload --- gitlab/functions.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gitlab/functions.sh b/gitlab/functions.sh index 7425107..155d887 100644 --- a/gitlab/functions.sh +++ b/gitlab/functions.sh @@ -147,11 +147,12 @@ dav_mkdir() { if [[ ${code} == *204 || ${code} == *201 ]]; then log_info "curl: mkdir ${DOCSERVER}/${1}" - # if the return code was not a success, the function should usually treat it as an error. - # however, sometimes the codes must be treated more flexibly, e.g.: - # dav_recursive_mkdir wants the directory created *or* already existing, - # which means that a 405 (directory already exists) should not be treated as an error. - # other codes may also have similar consideration in the future. + # if the return code was not a success, the function should usually treat it + # as an error. however, sometimes the codes must be treated more flexibly, + # e.g.: dav_recursive_mkdir wants the directory created *or* already + # existing, which means that a 405 (directory already exists) should not be + # treated as an error. other codes may also have similar consideration in + # the future. elif [[ "${code}" == "$2" ]]; then return "${code}" else @@ -221,6 +222,8 @@ dav_upload_folder() { exit 1 fi + dav_delete "${2}" + find "$1" | while read -r fname; do # replace the local path prefix ('../folder1/folder2/folder-to-upload/') # with the server path prefix ('private-upload/docs/test/') -- GitLab