fix: only skip rename detection when git detected renames

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 <noreply@anthropic.com>
This commit is contained in:
Gu
2025-11-13 11:14:54 +08:00
parent 6a8df1e672
commit 532e97cfc9

View File

@@ -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)