From 532e97cfc9cbdc819e97feb12d17b4d64bce0dab Mon Sep 17 00:00:00 2001 From: Gu Date: Thu, 13 Nov 2025 11:14:54 +0800 Subject: [PATCH] fix: only skip rename detection when git detected renames MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When files_to_sync is empty (e.g., R100 rename with no content changes), detect_file_changes doesn't run, so renamed_files is empty. Previously, reconcile ALWAYS skipped rename detection, so it treated renames as separate delete+add operations. Now, reconcile only skips rename detection if git actually found renames. Otherwise, it uses heuristic-based detection to handle the rename properly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- tools/translate/sync_and_translate.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/translate/sync_and_translate.py b/tools/translate/sync_and_translate.py index aa526e42..c5f682a6 100644 --- a/tools/translate/sync_and_translate.py +++ b/tools/translate/sync_and_translate.py @@ -1393,12 +1393,18 @@ class DocsSynchronizer: added_files.append(new_path) sync_log.append(f"INFO: Added {new_path} to translation queue (old translation not found)") - # Check for structural changes (moves only, not renames since we handled those) + # Check for structural changes (moves and possibly renames) if base_sha and head_sha: - sync_log.append("INFO: Checking for structural changes (moves)...") + # Only skip rename detection if we actually processed renames via git + skip_renames = len(renamed_files) > 0 + if skip_renames: + sync_log.append("INFO: Checking for structural changes (moves only, renames already handled)...") + else: + sync_log.append("INFO: Checking for structural changes (moves and renames)...") + reconcile_log = self.reconcile_docs_json_structural_changes( base_sha, head_sha, - skip_rename_detection=True # Skip broken rename detection - we handle renames properly above + skip_rename_detection=skip_renames ) sync_log.extend(reconcile_log)