Skip to content

Commit

Permalink
Merge pull request #5579 from vpodzime/master-mstrfls_stage_fix
Browse files Browse the repository at this point in the history
Fix early git revision comparison in masterfiles-stage.sh
  • Loading branch information
vpodzime authored Jul 12, 2024
2 parents a017384 + b15ee23 commit 705e27c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions contrib/masterfiles-stage/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down

0 comments on commit 705e27c

Please sign in to comment.