From 9ec20517441e4b4bd6106afa85222b422c98e952 Mon Sep 17 00:00:00 2001 From: Nikola Hristov Date: Fri, 5 Jun 2026 00:03:19 +0300 Subject: [PATCH] fix(scm): avoid setting both folderUri and workspace in ResolveConfiguration Setting both causes the workbench to register the same git repo twice, producing duplicate SCM group rows (Staged Changes, Changes, etc.). In Tauri/desktop context (Mountain), only workspace is read by DesktopMain. In browser context, only folderUri is read. Mutually exclude them. --- .../Install/Function/ResolveConfiguration.ts | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/Source/Function/Install/Function/ResolveConfiguration.ts b/Source/Function/Install/Function/ResolveConfiguration.ts index 82187391..d45f9be0 100644 --- a/Source/Function/Install/Function/ResolveConfiguration.ts +++ b/Source/Function/Install/Function/ResolveConfiguration.ts @@ -161,6 +161,15 @@ export async function ResolveConfiguration(): Promise { } } + // True when running inside a Tauri webview (Mountain desktop shell). + // DesktopMain reads `workspace` (ISingleFolderWorkspaceIdentifier). + // The browser workbench reads `folderUri`. + // Setting both causes the workbench to register the same git repository + // twice via two independent workspace resolution paths, which makes the + // Git extension call registerSCMProvider twice and produces duplicate + // SCM group rows in the Source Control view. + const IsTauri = typeof ResolveInvoke() === "function"; + try { if (typeof Invoke === "function") { Paths = await ( @@ -241,6 +250,8 @@ export async function ResolveConfiguration(): Promise { DevLog("config", "workspace:", JSON.stringify(Workspace)); + DevLog("config", "isTauri:", String(IsTauri)); + // Mountain returns logsPath as a session-timestamped directory // (e.g., .../logs/20260410T105248) with window1/ already created. // Use it directly - no additional timestamp nesting needed. @@ -560,11 +571,18 @@ export async function ResolveConfiguration(): Promise { extensionsPath: `${Paths.userDataDir || "/tmp/.fiddee"}/extensions`, - // Workspace - set from ?folder= URL param - // folderUri is used by the browser workbench; workspace by the Electron workbench. - folderUri: FolderUri, - - workspace: Workspace, + // Workspace resolution: folderUri and workspace must be mutually exclusive. + // Both being set causes the workbench to open the same git repository + // twice via two independent workspace paths, producing duplicate SCM + // provider registrations and duplicate group rows in the Source Control view. + // + // In Tauri/Mountain (desktop): DesktopMain.reviveIdentifier() reads + // `workspace` (ISingleFolderWorkspaceIdentifier). Pass workspace only. + // In browser (no Tauri): the browser workbench reads `folderUri`. + // Pass folderUri only. + folderUri: IsTauri ? undefined : FolderUri, + + workspace: IsTauri ? Workspace : undefined, backupPath: undefined,