From 864e6b7a3bc29fa7df68b13dccedfbd2fa738485 Mon Sep 17 00:00:00 2001 From: yang <188421097+HunYiSage@users.noreply.github.com> Date: Wed, 2 Sep 2026 18:27:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20silenceMnemonGitFlash=20=E5=9B=9E?= =?UTF-8?q?=E9=80=80=E8=B7=AF=E5=BE=84=E6=94=B9=E7=94=A8=20let=EF=BC=8C?= =?UTF-8?q?=E9=81=BF=E5=85=8D=20const=20=E9=87=8D=E8=B5=8B=E5=80=BC?= =?UTF-8?q?=E6=8A=9B=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/core.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/lib/core.js b/lib/core.js index 10dd5a8..cbaeb3d 100644 --- a/lib/core.js +++ b/lib/core.js @@ -261,26 +261,19 @@ export function silenceMnemonGitFlash(dshHome = findDshHome()) { if (hit === "missing") hit = "pattern_miss"; continue; } - const next = text.replace( + let next = text.replace( /function resolveGitBranch\(cwd\) \{[\s\S]*?\n\}\n\/\/#endregion\n\/\/#region src\/memory-view\.ts/, `${replacement}\n//#endregion\n//#region src/memory-view.ts`, ); if (next === text) { // Fallback: replace the function only (region comment may differ by mnemon build). - const alt = text.replace( + next = text.replace( /function resolveGitBranch\(cwd\) \{[\s\S]*?\n\}(?=\n\/\/#endregion)/, replacement, ); - if (alt === text) { - hit = "pattern_miss"; - continue; - } - try { - fs.writeFileSync(fp, alt, "utf8"); - hit = "patched"; - } catch (e) { - hit = `error:${e}`; - } + } + if (next === text) { + hit = "pattern_miss"; continue; } try {