From b44ba7216dab9382f96412a62efab54789acf004 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Sun, 1 Jun 2025 09:35:46 +0200 Subject: [PATCH] fix(material/schematics): avoid overwriting files that didn't change Fixes that the v20 update migration was overwriting all files, even if they didn't change. Fixes #31259. --- src/material/schematics/ng-update/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/material/schematics/ng-update/index.ts b/src/material/schematics/ng-update/index.ts index 18644fe90a00..b76c9f98966b 100644 --- a/src/material/schematics/ng-update/index.ts +++ b/src/material/schematics/ng-update/index.ts @@ -59,7 +59,9 @@ function renameMdcTokens(): Rule { if (shouldRenameTokens(path)) { const content = tree.readText(path); const updatedContent = content.replace('--mdc-', '--mat-'); - tree.overwrite(path, updatedContent); + if (content !== updatedContent) { + tree.overwrite(path, updatedContent); + } } }); };