From 0a3b744a020e2ee374ba2c583ec473623f4e9cc8 Mon Sep 17 00:00:00 2001 From: Bryce Meyer Date: Fri, 23 May 2025 13:04:29 +0200 Subject: [PATCH 1/2] made sure files are renamed properly --- update.sh | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/update.sh b/update.sh index 68aaf84c..98b20ee0 100755 --- a/update.sh +++ b/update.sh @@ -26,18 +26,26 @@ RENAMED=() while IFS= read -r line; do STATUS=$(echo "$line" | awk '{print $1}') - FILE=$(echo "$line" | awk '{print $2}') - if [[ "$FILE" == app/Providers/* || "$FILE" == UPGRADE*.md || "$FILE" == "update.sh" ]]; then - continue - fi - if [[ "$STATUS" == "A" || "$STATUS" == "M" ]]; then - ADDED_MODIFIED+=("$FILE") - elif [[ "$STATUS" == "D" ]]; then - DELETED+=("$FILE") - elif [[ "$STATUS" == "R" ]]; then + if [[ "$STATUS" == "R"* ]]; then + # For renamed files, the format is "R old_file new_file" OLD_FILE=$(echo "$line" | awk '{print $2}') NEW_FILE=$(echo "$line" | awk '{print $3}') + if [[ "$OLD_FILE" == app/Providers/* || "$OLD_FILE" == UPGRADE*.md || "$OLD_FILE" == "update.sh" ]]; then + continue + fi RENAMED+=("$OLD_FILE|$NEW_FILE") + elif [[ "$STATUS" == "A" || "$STATUS" == "M" ]]; then + FILE=$(echo "$line" | awk '{print $2}') + if [[ "$FILE" == app/Providers/* || "$FILE" == UPGRADE*.md || "$FILE" == "update.sh" ]]; then + continue + fi + ADDED_MODIFIED+=("$FILE") + elif [[ "$STATUS" == "D" ]]; then + FILE=$(echo "$line" | awk '{print $2}') + if [[ "$FILE" == app/Providers/* || "$FILE" == UPGRADE*.md || "$FILE" == "update.sh" ]]; then + continue + fi + DELETED+=("$FILE") fi done <<< "$CHANGED" @@ -46,10 +54,6 @@ for RENAME in "${RENAMED[@]}"; do OLD_FILE=$(echo "$RENAME" | cut -d'|' -f1) NEW_FILE=$(echo "$RENAME" | cut -d'|' -f2) - if [[ "$OLD_FILE" == app/Providers/* || "$OLD_FILE" == UPGRADE*.md || "$OLD_FILE" == "update.sh" ]]; then - continue - fi - OLD_PATH="$CHILD_PATH/$OLD_FILE" NEW_PATH="$CHILD_PATH/$NEW_FILE" From 3bd42161c50eee3bbf603d5835adff49a39abae1 Mon Sep 17 00:00:00 2001 From: Bryce Meyer Date: Fri, 23 May 2025 13:09:03 +0200 Subject: [PATCH 2/2] modified update script to copy from main repo --- update.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/update.sh b/update.sh index 98b20ee0..4b92a3f3 100755 --- a/update.sh +++ b/update.sh @@ -57,16 +57,15 @@ for RENAME in "${RENAMED[@]}"; do OLD_PATH="$CHILD_PATH/$OLD_FILE" NEW_PATH="$CHILD_PATH/$NEW_FILE" - # If the old file exists in child repo, move it to the new location + # Always copy the new file from the main repo to the new location in the child repo + mkdir -p "$(dirname "$NEW_PATH")" + cp "$NEW_FILE" "$NEW_PATH" + echo "Copied $NEW_FILE to $NEW_PATH in child repository (rename from $OLD_FILE)" + + # If the old file exists in the child repo, delete it if [ -f "$OLD_PATH" ]; then - mkdir -p "$(dirname "$NEW_PATH")" - mv "$OLD_PATH" "$NEW_PATH" - echo "Renamed $OLD_FILE to $NEW_FILE in child repository" - else - # If old file doesn't exist, just copy the new file - mkdir -p "$(dirname "$NEW_PATH")" - cp "$NEW_FILE" "$NEW_PATH" - echo "Copied $NEW_FILE to child repository (rename from $OLD_FILE)" + rm "$OLD_PATH" + echo "Deleted old file $OLD_PATH in child repository (renamed to $NEW_FILE)" fi done