@@ -102,14 +102,22 @@ jobs:
102102 SOURCE=$(echo "$LINE" | awk '{print $1}')
103103 DEST=$(echo "$LINE" | awk '{print $2}')
104104
105- # Check if there are actual content changes using git diff
106- # --numstat gives us numeric stats: added lines, removed lines, filename
107- # If the file was only renamed with no content changes, it will show 0 0
108- GIT_DIFF=$(git diff --cached --numstat "$SOURCE" "$DEST")
109- ADDED_LINES=$(echo "$GIT_DIFF" | awk '{print $1}')
110- REMOVED_LINES=$(echo "$GIT_DIFF" | awk '{print $2}')
105+ # Check if there are actual content changes using git diff with -M (detect renames)
106+ # If there's output from the diff command beyond the rename header, there are content changes
107+ DIFF_OUTPUT=$(git diff --cached -M -- "$SOURCE" "$DEST")
108+ # Count lines that start with +/- (changes) but ignore the rename header lines
109+ CHANGE_COUNT=$(echo "$DIFF_OUTPUT" | grep -v "^renamed:" | grep -v "^─" | grep -E "^\+|^-" | wc -l)
111110
112- echo "Git diff for $SOURCE → $DEST: $ADDED_LINES lines added, $REMOVED_LINES lines removed"
111+ echo "Git diff for $SOURCE → $DEST: $CHANGE_COUNT lines changed"
112+
113+ # Determine if this is just a rename or if content was also changed
114+ if [ "$CHANGE_COUNT" -eq 0 ]; then
115+ CONTENT_UNCHANGED=true
116+ echo "Pure rename detected (no content changes)"
117+ else
118+ CONTENT_UNCHANGED=false
119+ echo "Content changes detected along with rename"
120+ fi
113121
114122 # Replace 'en' with current locale in paths
115123 SOURCE_LOCALE=${SOURCE/content\/en/content\/$LOCALE}
@@ -126,8 +134,7 @@ jobs:
126134
127135 # If the content is identical (just a rename, not a modification)
128136 # then update the timestamps in the translation file
129- # Git diff showing 0 added and 0 removed lines means identical content
130- if [ "$ADDED_LINES" = "0" ] && [ "$REMOVED_LINES" = "0" ]; then
137+ if [ "$CONTENT_UNCHANGED" = "true" ]; then
131138 echo "Content unchanged, updating timestamps in $DEST_LOCALE"
132139
133140 # Update source-updated-at and translation-updated-at in the file
0 commit comments