diff --git a/code/app/Athenia/Jobs/Statistics/ProcessTargetStatisticsJob.php b/code/app/Athenia/Jobs/Statistic/ProcessTargetStatisticsJob.php similarity index 96% rename from code/app/Athenia/Jobs/Statistics/ProcessTargetStatisticsJob.php rename to code/app/Athenia/Jobs/Statistic/ProcessTargetStatisticsJob.php index 1b814dc7..c1dab974 100644 --- a/code/app/Athenia/Jobs/Statistics/ProcessTargetStatisticsJob.php +++ b/code/app/Athenia/Jobs/Statistic/ProcessTargetStatisticsJob.php @@ -1,7 +1,7 @@ "$REPORT" +# Compare added/modified files for FILE in "${ADDED_MODIFIED[@]}"; do if [[ "$FILE" == app/Providers/* || "$FILE" == UPGRADE*.md || "$FILE" == "update.sh" ]]; then continue @@ -88,6 +119,28 @@ for FILE in "${ADDED_MODIFIED[@]}"; do rm -f /tmp/main_diff /tmp/child_diff done +# Compare renamed files +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 + + # Generate unified diff in main repo for the rename + git diff "$LAST_TAG" -- "$NEW_FILE" | grep -v '^index' | sed 's/[[:space:]]*$//' > /tmp/main_diff + # Generate unified diff in child repo for the new file + pushd "$CHILD_PATH" > /dev/null + git diff -- "$NEW_FILE" | grep -v '^index' | sed 's/[[:space:]]*$//' > /tmp/child_diff + popd > /dev/null + # Compare the diffs byte-for-byte + if ! diff -q /tmp/main_diff /tmp/child_diff > /dev/null; then + echo "$NEW_FILE (renamed from $OLD_FILE)" >> "$REPORT" + fi + rm -f /tmp/main_diff /tmp/child_diff +done + # Compare deleted files for FILE in "${DELETED[@]}"; do if [[ "$FILE" == app/Providers/* || "$FILE" == UPGRADE*.md || "$FILE" == "update.sh" ]]; then