diff --git a/contrib/masterfiles-stage/common.sh b/contrib/masterfiles-stage/common.sh index 77d6b813f7..250bbae34c 100755 --- a/contrib/masterfiles-stage/common.sh +++ b/contrib/masterfiles-stage/common.sh @@ -94,6 +94,10 @@ git_deploy_refspec() { mkdir -p "$(dirname "$1")" || error_exit "Failed to mkdir -p dirname $1" # We don't mkdir $1 directly, just its parent dir if that doesn't exist. + if git_check_is_in_sync "${local_mirrored_repo}" "$1" "$2"; then + return 0 + fi + ########################## 1. CREATE EMPTY TEMP DIR # Put staging dir right next to deploy dir to ensure it's on same filesystem local temp_stage @@ -112,10 +116,6 @@ git_deploy_refspec() { mkdir -p "${temp_stage}/.git" cp "${local_mirrored_repo}/HEAD" "${temp_stage}/.git/" - if git_check_is_in_sync "${local_mirrored_repo}" "${temp_stage}" "$2"; then - return 0 - fi - ########################## 3. SET PERMISSIONS ON POLICY SET chown -R root:root "${temp_stage}" || error_exit "Unable to chown '${temp_stage}'" find "${temp_stage}" \( -type f -exec chmod 600 {} + \) -o \ @@ -211,6 +211,10 @@ git_cfbs_deploy_refspec() { mkdir -p "$(dirname "$1")" || error_exit "Failed to mkdir -p dirname $1" # We don't mkdir $1 directly, just its parent dir if that doesn't exist. + if git_check_is_in_sync "${local_mirrored_repo}" "$1" "$2"; then + return 0 + fi + ########################## 1. CREATE EMPTY TEMP DIR # Put staging dir right next to deploy dir to ensure it's on same filesystem local temp_stage @@ -238,10 +242,6 @@ git_cfbs_deploy_refspec() { mkdir -p "${temp_stage}/out/masterfiles/.git" cp "${local_mirrored_repo}/HEAD" "${temp_stage}/out/masterfiles/.git/" - if git_check_is_in_sync "${local_mirrored_repo}" "${temp_stage}/out/masterfiles" "$2"; then - return 0 - fi - ########################## 3. SET PERMISSIONS ON POLICY SET chown -R root:root "${temp_stage}" || error_exit "Unable to chown '${temp_stage}'" find "${temp_stage}" \( -type f -exec chmod 600 {} + \) -o \